Filter löschen
Filter löschen

help!!!plot problem not a line

2 Ansichten (letzte 30 Tage)
Qiandong Dong
Qiandong Dong am 26 Dez. 2019
Beantwortet: Mohammad Sami am 26 Dez. 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?

Akzeptierte Antwort

Mohammad Sami
Mohammad Sami am 26 Dez. 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

Weitere Antworten (0)

Kategorien

Mehr zu Graphics Objects finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by