not getting plot , why?

1 vue (au cours des 30 derniers jours)
Sourav singh
Sourav singh le 8 Mar 2021
Commenté : Alan Stevens le 8 Mar 2021
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

Réponses (1)

Alan Stevens
Alan Stevens le 8 Mar 2021
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 commentaires
Sourav singh
Sourav singh le 8 Mar 2021
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 le 8 Mar 2021
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");

Connectez-vous pour commenter.

Catégories

En savoir plus sur Instrument Control Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by