not getting plot , why?

1 次查看(过去 30 天)
Sourav singh
Sourav singh 2021-3-8
for h=0:100:1200
rho = 1.225*((288-0.0065*h)/288)^4.2561;
sigma=0.047193;
V_tip=180;
W=180;
Cd_avg=0.01;
R=2.235;
k=1.1;
A=pi*R.^2;
P_e= 61147.4;
P_req=k*((W)^(3/2))./sqrt(2.*rho.*A)+(Cd_avg*rho*sigma*A.*(V_tip).^3)./(8) +747.643-(0.3*P_e);
V_c=(P_e-P_req)./W;
hold on
plot(V_c,h,'r--');
xlabel("vc");
ylabel("h");
plot(P_req,h,'b')
end

回答(1 个)

Alan Stevens
Alan Stevens 2021-3-8
Arrange it like this
sigma=0.047193;
V_tip=180;
W=180;
Cd_avg=0.01;
R=2.235;
k=1.1;
A=pi*R.^2;
P_e= 61147.4;
h=0:100:1200;
for i = 1:numel(h)
rho = 1.225*((288-0.0065*h(i))/288)^4.2561;
P_req(i)=k*((W)^(3/2))./sqrt(2.*rho.*A)+(Cd_avg*rho*sigma*A.*(V_tip).^3)./(8) +747.643-(0.3*P_e);
V_c(i)=(P_e-P_req(i))./W;
end
subplot(2,1,1)
plot(V_c,h,'r--');
xlabel("vc");
ylabel("h");
subplot(2,1,2)
plot(P_req,h,'b')
xlabel("preq");
ylabel("h");
  2 个评论
Sourav singh
Sourav singh 2021-3-8
i want to plot the four values in a single graph like
plot(V_c,h,P_req,h)
how can i do this ??
Alan Stevens
Alan Stevens 2021-3-8
Change
subplot(2,1,1)
plot(V_c,h,'r--');
xlabel("vc");
ylabel("h");
subplot(2,1,2)
plot(P_req,h,'b')
xlabel("preq");
ylabel("h");
to
plot(V_c,h,'r--',P_req,h,'b');
xlabel("vc and preq");
ylabel("h");

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Instrument Control Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by