help!!!plot problem not a line

조회 수: 1 (최근 30일)
Qiandong Dong
Qiandong Dong 2019년 12월 26일
답변: Mohammad Sami 2019년 12월 26일
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?

채택된 답변

Mohammad Sami
Mohammad Sami 2019년 12월 26일
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개)

카테고리

Help CenterFile Exchange에서 Graphics Objects에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by