When I run the script file I get the values of my variables in the command window. But the problem is that it does not display all data as there may be about 5000 to 6000 values. What can I do to extract all the values of my variables?
1 次查看(过去 30 天)
显示 更早的评论
The code goes this way: clear all; clc; dh=0.0005; k=1.4; M2=3.765; Rg=287.04; g=1.4; gplus=(g+1); gminus=(g-1); CP=g*Rg/gminus; hs=asin(k/M2);
once=0; %switch for calculating inflection point only for this shock angle hsinput=hs; T2=1000; %any value will do asq=g*Rg*T2; V2=M2*sqrt(asq); SHS=sin(hs); CHS=cos(hs); M_2n=M2*SHS; M_2t=M2*CHS; p3p2=(2*g*M_2n^2-gminus)/gplus; p2p3=1/p3p2; %COTDEL=(2*(CHS/SHS)*(k*k-1))/(2+M2*M2*(g+1-2*SHS*SHS)); COTDEL = SHS / CHS * (gplus * M2^2 / 2/ (M_2n^2 - 1) - 1); del23=atan(1/COTDEL); MU2=asin(1/M2); alpha=pi-MU2-del23; del23deg=del23*180/3.1416; %Initial conditions for integration H=hs-del23; Hdeg=H*180/3.1416; deldeg=del23*180/3.1416; r=2; x=r*cos(H); x3=x; y=r*sin(H); y3=y;
s=0; surf=0; once=0; %Conditions in front of shock T=T2; asq=g*Rg*T; Ssound=sqrt(asq); %temp. and sound speed V_r=M_2t*Ssound; %radial velocity V_theta=-1*M_2n*Ssound; %angular velocity M=sqrt(M_2t*M_2t+M_2n*M_2n);%Mach number Vx=V_r*cos(H)-V_theta*sin(H); Vy=V_r*sin(H)+V_theta*cos(H); delta=atan(Vy/Vx); %%loop starts here %V=M*Ssound absolute velocity %Integration of TM equation using fourth order rungee kutta scheme %while 1 h=H; u=V_r; v=V_theta; t=T; asq=g*Rg*t; t1=asq*(u+v/tan(h)); t2=v^2-asq; R=r; RK1=v*dh; RL1=(-1*u+t1/t2)*dh; RM1=-1*v*t1/t2/CP*dh; RN1=(R*u/v)*dh;
h=H+dh/3;
u=V_r+RK1/3;
v=V_theta+RL1/3;
t=T+RM1/3;
asq=g*Rg*t;
t1=asq*(u+v/tan(h));
t2=v^2-asq;
R=r+RN1/3;
RK2=v*dh;
RL2=(-1*u+t1/t2)*dh;
RM2=-1*v*t1/t2/CP*dh;
RN2=(R*u/v)*dh;
h=H+dh*2/3;
u=V_r-RK1/3+RK2;
v=V_theta-RL1/3+RL2;
t=T-RM1/3+RM2;
asq=g*Rg*t;
t1=asq*(u+v/tan(h));
t2=v^2-asq;
R=r-RN1/3+RN2;
RK3=v*dh;
RL3=(-1*u+t1/t2)*dh;
RM3=-1*v*t1/t2/CP*dh;
RN3=(R*u/v)*dh;
h=H+dh;
u=V_r+RK1-RK2+RK3;
v=V_theta+RL1-RL2+RL3;
t=T+RM1-RM2+RM3;
asq=g*t*Rg;
t1=asq*(u+v/tan(h));
t2=v^2-asq;
R=r+RN1-RN2+RN3;
RK4=v*dh;
RL4=(-1*u+t1/t2)*dh;
RM4=-1*v*t1/t2/CP*dh;
RN4=(R*u/v)*dh;
%calculating increments for each variables
du=(RK1+3*RK2+3*RK3+RK4)/8;
dv=(RL1+3*RL2+3*RL3+RL4)/8;
dt=(RM1+3*RM2+3*RM3+RM4)/8;
dr=(RN1+3*RN2+3*RN3+RN4)/8;
ds=sqrt(dr^2+(r*dh)^2);
dsurf=2*pi*r*ds;
V_r=V_r+du; V_theta=V_theta+dv; T=T+dt; r=r+dr; H=H+dh; s=s+ds; surf=surf+dsurf; %end of Runge-kutta integration for one point
x=r*cos(H); y=r*sin(H); Vel=sqrt(V_r*V_r+V_theta*V_theta); Ssound=sqrt(g*Rg*T); M=Vel/Ssound; M1=M; Vx=V_r*cos(H)-V_theta*sin(H); Vy=V_r*sin(H)+V_theta*cos(H); delta=atan(Vy/Vx); Hdeg=H*180/3.1416; deltadeg=delta*180/3.1416; pp2=((1+gminus*M2^2/2)/(1+gminus*M^2/2))^(g/gminus); pp3=pp2/p3p2;
%%calculation of internal compression and kantrowitz area %check for inflection point once only %alpha=pi-H+delta; Vold=Vy; deltadegold=delta; Hdegold=Hdeg; xold=x; yold=y; Mold=M; Velold=Vel; Told=T; fprintf('\n%f\t',M) %if (delta>0 Vy>0 H<0||V_theta>0 dt>0) % break
%end %end
回答(1 个)
Image Analyst
2018-5-27
Put your values into a variable, which you probably already are, then look in the workspace - double click on the variable to display it in a spreadsheet in the variable editor.
The other option is to save it to a file with fprintf().
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Debugging and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!