# Question in MATLAB

Show 40 post(s) from this thread on one page
Page 1 of 2 12 Last
• Dec 26th 2011, 11:42 PM
nezar
Question in MATLAB
[IMG]http://img823.imageshack.us/img823/2572/42582392.png [/IMG]
• Dec 27th 2011, 05:26 AM
Ackbeet
Re: Question in MATLAB
Quote:

Originally Posted by nezar
[IMG]http://img823.imageshack.us/img823/2572/42582392.png [/IMG]

What ideas have you had so far?
• Dec 27th 2011, 06:32 AM
nezar
Re: Question in MATLAB
actually no
• Dec 27th 2011, 07:05 AM
Ackbeet
Re: Question in MATLAB
I would probably start by defining a vector that contains the \$\displaystyle R_{L}\$ values. How could you do that?
• Dec 27th 2011, 08:36 AM
CaptainBlack
Re: Question in MATLAB
Quote:

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
• Dec 27th 2011, 09:05 AM
nezar
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);
• Dec 27th 2011, 09:45 AM
Ackbeet
Re: Question in MATLAB
Quote:

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.
• Dec 27th 2011, 09:51 AM
CaptainBlack
Re: Question in MATLAB
Quote:

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
• Dec 27th 2011, 10:15 AM
nezar
Re: Question in MATLAB
Quote:

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 [.
• Dec 27th 2011, 10:50 AM
Ackbeet
Re: Question in MATLAB
Quote:

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;
• Dec 27th 2011, 10:55 AM
nezar
Re: Question in MATLAB
Quote:

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

CB

no
• Dec 27th 2011, 11:11 AM
nezar
Re: Question in MATLAB
Quote:

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;
• Dec 27th 2011, 11:13 AM
Ackbeet
Re: Question in MATLAB
Quote:

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;
• Dec 27th 2011, 11:41 AM
nezar
Re: Question in MATLAB
Quote:

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;

yes i get the answer(Happy)
thank you for help me
• Dec 27th 2011, 11:43 AM
Ackbeet
Re: Question in MATLAB
Quote:

Originally Posted by nezar
yes i get the answer(Happy)
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?
Show 40 post(s) from this thread on one page
Page 1 of 2 12 Last