i want to print the result in table

1 回表示 (過去 30 日間)
abdalrhman hassan
abdalrhman hassan 2018 年 2 月 10 日
コメント済み: abdalrhman hassan 2018 年 2 月 10 日
i want to print all the Result after finishing the code in table
Theta V X Pnew T like this
clc;clear;
B=79.21/1000;
a=30.835/1000 ;
L=83.919/1000 ;
i=1;
P_I=600;
RPM=250;
d_time=(5/360)*(60/RPM);
p_dash(1)=.99*(P_I);
T(1)=300;
R=.287;
V(1)=27/1000000;
c_d=.6;
h=8;
Lin(1)=20.722;
Tw=290;
cp=1.005;
m(1)=p_dash(1).*V(1)./(R*T(1));
Theta=0:5:360;
x=(a+L)-a.*cosd(Theta)-L.*sqrt(1-((a.*sind(Theta)./(L)).^2));
V=((pi/4)*(B^2)*(x))+V(1);
tol=1;
p(i)=p_dash(1);
i=1;
Pnew(1)=.99*(P_I);
for Theta=5:5:120
if (Theta >0) && (Theta <=60)
Lin(i+1)=(-6*(10^-5)*((Theta*pi/180)^3))+(.0057*((Theta*pi/180)^2))-(.0405*((Theta*pi/180)))+20.722;
i=i+1;
end
if (Theta >60) && (Theta <=120)
Lin(i+1)=(1/(50000)).*((Theta).^3)-((.0055.*((Theta).^2)))+((.3594*((Theta))))+19.961;
i=i+1;
end
end
i=0;
for Theta=160:5:300
if (Theta >=160) && (Theta <=210)
Lex(i+1)=(-4*(10^-5)*((Theta)^3))+(.0224*((Theta)^2))-(4.0192*((Theta)))+254;
i=i+1;
end
if (Theta >210) && (Theta <=300)
Lex(i+1)=(-8*(10^-7)*((Theta)^4))+(.0008*((Theta)^3))-((.3102.*((Theta).^2)))+((52.361*((Theta))))-3255;
i=i+1;
end
end
i=0;
j=0;
for Theta=5:5:360
if (Theta<=120)
i=i+1;
p(i+1)=.9*p(i);
while tol > 0.000000000001
rho=(p(i)+p(i+1))./(2*R*T(i));
Mi=.8*c_d*(pi/4)*((Lin(i+1)/1000)^2)*sqrt(2*rho.*(p(i)-p(i+1)));
d_Mi=Mi*d_time;
m(i+1)=m(i)+d_Mi;
T(i+1)=(d_time*h*pi*B*x(i+1).*(2*Tw-T(i))+((p(i)+p(i+1)).*(1000)).*(V(i+1)-V(i))+2*m(i)*cp*1000*T(i))./((2*m(i+1)).*(cp*1000)+(d_time*h*pi*B.*x(i+1)));
Pnew(i+1)=m(i+1).*R*T(i+1)./(V(i+1));
tol=(Pnew(i+1)-p(i+1))./(Pnew);
p(i+1)=Pnew(i+1);
end
tol=1;
p(i)=Pnew(i+1);
end
if (Theta>120) && (Theta<160)
i=i+1;
p(i+1)=.9*p(i);
while tol > 0.0000000000001
m(i+1)=m(i);
T(i+1)=(d_time*h*pi*B*x(i+1).*(2*Tw-T(i))+((p(i)+p(i+1)).*(1000)).*(V(i+1)-V(i))+2*m(i)*cp*1000*T(i))./((2*m(i+1)).*(cp*1000)+(d_time*h*pi*B.*x(i+1)));
Pnew(i+1)=m(i+1).*R*T(i+1)./(V(i+1));
tol=(Pnew(i+1)-p(i+1))./(Pnew);
p(i+1)=Pnew(i+1);
end
tol=1;
p(i)=Pnew(i+1);
end
if (Theta>=160) && (Theta<=300)
i=i+1;
j=j+1;
p(i+1)=.9*p(i);
while tol > 0.059
rho=(p(i)+p(i+1))./(2*R*T(i));
Me=.8*c_d*(pi/4)*((.03)^2)*(sqrt(2*rho.*((p(i))-(p(i+1)))));
d_Me=Me.*d_time;
m(i+1)=(m(i))-(d_Me);
T(i+1)=(d_time*h*pi*B*x(i+1).*(2*Tw-T(i))+((p(i)+p(i+1)).*(1000)).*(V(i+1)-V(i))+2*m(i)*cp*1000*T(i))./((2*m(i+1)).*(cp*1000)+(d_time*h*pi*B.*x(i+1)));
Pnew(i+1)=m(i+1).*R*T(i+1)./(V(i+1));
tol=(Pnew(i+1)-p(i+1))./(Pnew);
p(i+1)=Pnew(i+1);
end
tol=1;
p(i)=Pnew(i+1);
end
if (Theta>300) && (Theta<=360)
i=i+1;
p(i+1)=.9*p(i);
while tol > 0.0000000000001
m(i+1)=m(i);
T(i+1)=(d_time*h*pi*B*x(i+1).*(2*Tw-T(i))+((p(i)+p(i+1)).*(1000)).*(V(i+1)-V(i))+2*m(i)*cp*1000*T(i))./((2*m(i+1)).*(cp*1000)+(d_time*h*pi*B.*x(i+1)));
Pnew(i+1)=m(i+1).*R*T(i+1)./(V(i+1));
tol=(Pnew(i+1)-p(i+1))./(Pnew);
p(i+1)=Pnew(i+1);
end
tol=1;
p(i)=Pnew(i+1);
end
end
  2 件のコメント
Stephen23
Stephen23 2018 年 2 月 10 日
@abdalrhman hassan: what is your question? You forgot to ask us anything.
abdalrhman hassan
abdalrhman hassan 2018 年 2 月 10 日
i want to print the result in a table Theta Pnew T V X like this all the value

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2018 年 2 月 10 日
data = [Theta(:), V(:), X(:), Pnew(:), T(:)] .'; %transpose is important
fprintf('Theta\tV\tX\tPnew\tT\n');
fprintf('%g\t%g\t%g\t%g\t%g\n', data);
  1 件のコメント
abdalrhman hassan
abdalrhman hassan 2018 年 2 月 10 日
thank you sir

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWeb Services についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by