MATLAB: Help!!!plot problem not a line

plot problem just a point

clear all
a=400;
b=2;
k=6;
v=200;
e=2;
cp=2;
pr=1;
w=15;
u=0.1:1;
p=(2.*a.*v + 2.*b.*v.*w – 2.*cp.*e.*k.*v – a.*b.*pr.^2*u.^2 + b.*cp.*e.*k.*pr.^2*u.^2)./(b.*(- b.*pr.^2*u.^2 + 4.*v));
plot(p,'rs-','Linewidth',1.5)
grid on;
Why just a point when plot?

Best Answer

This is because your code as stated will only output a single value for variable 'p';
This is because of how you initialised the variable 'u'.
u=0.1:1;
u % u is assigned a value of 0.1.
I assume you were trying to initialise u as a vector between 0.1 and 1, with increments of 0.1. You can do it as follows
u = 0.1:0.1:1;
u