Info

This question is closed. Reopen it to edit or answer.

Hi. I've got this code and I want to calculate 8 values of ve, pe and Te without having to write the code over and over again. I need a loop but I don't know how to do it?

1 view (last 30 days)
%Defining constants
A=24205.7370;
B=145317.1585;
C=491550.6260;
R=287;
c_p_e=1004.5;
v_e_guess=0;
p_e_guess=101000;
T_e_guess=293.15;
%Equations
v_e=(A*T_e_guess)/p_e_guess;
p_e=B-(A*v_e/R);
T_e=(C-(v_e.^2)/2)/c_p_e;
v_e_2=A*T_e/p_e;
p_e_2=B-(A*v_e_2/R);
T_e_2=(C-(v_e_2.^2)/2)/c_p_e;
v_e_3=A*T_e_2/p_e_2;
p_e_3=B-(A*v_e_3/R);
T_e_3=(C-(v_e_3.^2)/2)/c_p_e;
v_e = sprintf('%10.6f',v_e)
p_e = sprintf('%10.3f',p_e)
T_e = sprintf('%10.6f',T_e)
v_e_2 = sprintf('%10.6f',v_e_2)
p_e_2 = sprintf('%10.3f',p_e_2)
T_e_2 = sprintf('%10.6f',T_e_2)
v_e_3 = sprintf('%10.6f',v_e_3)
p_e_3 = sprintf('%10.3f',p_e_3)
T_e_3 = sprintf('%10.6f',T_e_3)

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!