help!!!plot problem not a line
1 view (last 30 days)
Show older comments
Qiandong Dong
on 26 Dec 2019
Answered: Mohammad Sami
on 26 Dec 2019
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?
0 Comments
Accepted Answer
Mohammad Sami
on 26 Dec 2019
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
0 Comments
More Answers (0)
See Also
Categories
Find more on Graphics Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!