# Math Help - Question in MATLAB

[IMG] [/IMG]

2. ## Re: Question in MATLAB

Originally Posted by nezar
[IMG] [/IMG]
What ideas have you had so far?

actually no

4. ## Re: Question in MATLAB

I would probably start by defining a vector that contains the $R_{L}$ values. How could you do that?

5. ## Re: Question in MATLAB

Originally Posted by nezar
actually no
Why not this is not the first Matlab plot question you have asked?

In fact I see no reason why you should have a problem with this since you have code to plot the other one.

CB

6. ## Re: Question in MATLAB

i am sorry i am really try to get the answer ,but i don't get any thing
rl=(1,10,1000);
p=12^2.*rl/(rl+2.5)^2;
plot(p);

7. ## Re: Question in MATLAB

Originally Posted by nezar
i am sorry i am really try to get the answer ,but i don't get any thing
rl=(1,10,1000);
p=12^2.*rl/(rl+2.5)^2;
plot(p);
I would modify your last line. What your current last line will do is plot p as a function of the index. But you really want to plot as a function of rl. Hence, I would do this:

plot(rl,p)

See what that does.

8. ## Re: Question in MATLAB

Originally Posted by nezar
i am sorry i am really try to get the answer ,but i don't get any thing
rl=(1,10,1000);
p=12^2.*rl/(rl+2.5)^2;
plot(p);
Have you tried typing any of this at the command line?

CB

9. ## Re: Question in MATLAB

Originally Posted by Ackbeet
I would modify your last line. What your current last line will do is plot p as a function of the index. But you really want to plot as a function of rl. Hence, I would do this:

plot(rl,p)

See what that does.
i try but he gave me
??? Error: File: nezarn.m Line: 1 Column: 6
Expression or statement is incorrect--possibly unbalanced (, {, or [.

10. ## Re: Question in MATLAB

Originally Posted by nezar
i try but he gave me
??? Error: File: nezarn.m Line: 1 Column: 6
Expression or statement is incorrect--possibly unbalanced (, {, or [.
I suspect your first line is not the correct syntax for defining a vector in MATLAB. You're after, apparently, a vector containing 1000 numbers ranging from 1 to 10. Try this expression instead:

rl=1:0.009:10;

11. ## Re: Question in MATLAB

Originally Posted by CaptainBlack
Have you tried typing any of this at the command line?

CB
no

12. ## Re: Question in MATLAB

Originally Posted by Ackbeet
I suspect your first line is not the correct syntax for defining a vector in MATLAB. You're after, apparently, a vector containing 1000 numbers ranging from 1 to 10. Try this expression instead:

rl=1:0.009:10;
error
??? Error using ==> mpower
Matrix must be square.

Error in ==> nezarn at 2
p=12^2.*rl/(rl+2.5)^2;

13. ## Re: Question in MATLAB

Originally Posted by nezar
error
??? Error using ==> mpower
Matrix must be square.

Error in ==> nezarn at 2
p=12^2.*rl/(rl+2.5)^2;
Try using dots everywhere, since you're wanting component-wise arithmetic. That is, try

p=12^2.*rl./(rl+2.5).^2;

Note: you actually don't need a dot for the first one, because that's a scalar. So you could probably do

p=12^2*rl./(rl+2.5).^2;

14. ## Re: Question in MATLAB

Originally Posted by Ackbeet
Try using dots everywhere, since you're wanting component-wise arithmetic. That is, try

p=12^2.*rl./(rl+2.5).^2;

Note: you actually don't need a dot for the first one, because that's a scalar. So you could probably do

p=12^2*rl./(rl+2.5).^2;
thank you for help me

15. ## Re: Question in MATLAB

Originally Posted by nezar
thank you for help me
So, in paying attention to CB's posts, let me ask you these questions:

1. Do you know why you got the errors you got?
2. Do you know how to fix them once you see them again?
3. Do you see why MATLAB didn't like your previous syntax?
4. Does your graph make sense?

Page 1 of 2 12 Last