The fprintf prints 40 values for each M, T, p, and A, however when I try and produce a table with the respected values, I only get a 1×4 table at the last iteration. I want to produce a 4×40 table with the calculated values.
% Constants
gamma = 1.27;x = (gamma - 1)/(gamma + 1);% Initial Guesses
T = 1;p = 1;A = 10;% Loop
for M = 0:.05:2 T = (1-x)/((1+(x*((M^2)-1)))); p = (T)^((x+1)/(2*x)); A = ((1+x*((M^2)-1))^(1/(2*x)))/(M); fprintf('M %d: T=%.20f, p=%.20f\n, A=%.20f\n', M, T, p, A);endTable = table(M',T',p',A','variablenames',{'M','T','p','A'});
Best Answer