f



Plots in MATLAB - basic question

Dear all,

I am attempting to plot the yaw velocity gain for an automobile system in MATLAB. This is straightforward - just an equation to calculate it and then plotting G_yvg on the y-axis against v_x on the x axis. I would like my values for v_x to be from 5 to 50. I attempted to run the code below:

-- Code start --

% Bicycle Model for car A - The understeer car

m = 1669;
I_z = 3144;
l_F = 1.178;
l_R = 1.567;
l = l_F + l_R;
C_F = 59410;
C_R = 50730;
K_us = 9.409*10^-3;
g = 9.81;

v_x = 5:1:50; % This needs to be values between 5 and 50

G_yvg = v_x/l+(K_us*v_x^2/g);

plot(v_x,G_yvg);

-- Code End --

But I was presented with the following error

??? Error using ==> mpower
Inputs must be a scalar and a square matrix.

Error in ==> Car_A_Q2a at 15
G_yvg = v_x/l+(K_us*v_x^2/g);


--
I think my problem is either because I have not appropriately set the range of values of v_x to be plotted (I am not sure how to do this!) or because MATLAB is thinking that I am attempting to define a matrix rather than a linear equation in line 15, for some reason.

Please could anyone advise me on how to proceed?

Kind Regards,
Adam Lord

Engineering Student (UK). 
0
Adam
1/3/2011 6:01:06 PM
comp.soft-sys.matlab 211266 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

2 Replies
1146 Views

Similar Articles

[PageSpeed] 49

"Adam Lord" <adamtlord@gmail.com> wrote in message <ift2t2$cbo$1@fred.mathworks.com>...
> Dear all,
> 
> I am attempting to plot the yaw velocity gain for an automobile system in MATLAB. This is straightforward - just an equation to calculate it and then plotting G_yvg on the y-axis against v_x on the x axis. I would like my values for v_x to be from 5 to 50. I attempted to run the code below:
*snip*
> G_yvg = v_x/l+(K_us*v_x^2/g);

try

 G_yvg = v_x/l+(K_us.*v_x.^2/g);%<-- note dot before ^ and *
0
proecsm
1/3/2011 6:11:06 PM
Thank you Fred - plot now works!
0
Adam
1/3/2011 6:50:28 PM
Reply: