i want to print the result in table

1 visualizzazione (ultimi 30 giorni)
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 Commenti
Stephen23
Stephen23 il 10 Feb 2018
@abdalrhman hassan: what is your question? You forgot to ask us anything.
abdalrhman hassan
abdalrhman hassan il 10 Feb 2018
i want to print the result in a table Theta Pnew T V X like this all the value

Accedi per commentare.

Risposta accettata

Walter Roberson
Walter Roberson il 10 Feb 2018
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);

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by