필터 지우기
필터 지우기

not getting plot , why?

조회 수: 1 (최근 30일)
Sourav singh
Sourav singh 2021년 3월 8일
댓글: Alan Stevens 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에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by