My graph is blank
5 次查看(过去 30 天)
显示 更早的评论
ive written a code and the numbers on the x and y axis show up but im not getting any actual plots.
w = input('Enter weight "W" of aircraft value(kg)');
c_d0 = input('Enter profile drag coefficient "C_d0" of aircraft value');
s = input('Enter wing span "S" of aircraft value(m)');
p_0 = input('Enter initial power at sea level "P_0" of aircraft engine value(W)');
k = input('Enter induced drag coefficient "K" of aircraft value');
rho_0 = 1.225;
h=0:0.1:20;
for i=1:length(h)
sigma(i)=20-h(i)/20+h(i);
a=c_d0*0.5*rho_0*s;
b=-p_0;
c=k*w^2/0.5*rho_0*sigma(i).^2*s;
y=[a 0 0 b c];
r=roots(y);
end
plot(r(3),h,r(4),h)
2 个评论
回答(1 个)
KSSV
2020-6-4
w = input('Enter weight "W" of aircraft value(kg)');
c_d0 = input('Enter profile drag coefficient "C_d0" of aircraft value');
s = input('Enter wing span "S" of aircraft value(m)');
p_0 = input('Enter initial power at sea level "P_0" of aircraft engine value(W)');
k = input('Enter induced drag coefficient "K" of aircraft value');
rho_0 = 1.225;
h=0:0.1:20;
r3 = zeros(size(h)) ;
r4 = zeros(size(h)) ;
for i=1:length(h)
sigma(i)=20-h(i)/20+h(i);
a=c_d0*0.5*rho_0*s;
b=-p_0;
c=k*w^2/0.5*rho_0*sigma(i).^2*s;
y=[a 0 0 b c];
r=roots(y);
r3(i) = y(3) ;
r4(i) = y(4) ;
end
plot(r3,h,r4,h)
4 个评论
KSSV
2020-6-4
You can get min and max using:
r3(i) = min(y) ;
r4(i) = max(y) ;
You need to rethink on your code.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Construction 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!