Situation: Rocket nozzle design.
Code:
% code
gamma=1.4;R=287; %Gas constant
P0=22313; %Pascals
A_star=0.2; %Throat area in m^2
Ae=1:10;Me=1;for i=Ae AeAs(i)=Ae(i)/A_star; Ae_As(i)=(1/Me(i))*((2/(gamma+1))*(1+((gamma-1)/2)*(Me(i)^2)))^((gamma+1)/2*(gamma-1))==AeAs(i); solMe(i)=solve(Ae_As(i),Me(i));end
I have to vary the area ratio of the exit area of the nozzle (Ae) to the area of the throat (A_star). A_star is fixed, A_e varies. (I have it varying from 1:10). So there are 10 different values for Ae/A_star. Using the equation labeled as "Ae_As(i)", I can solve for Me (exit Mach number). I tried to do this using the solve function which can be seen in the solMe line. When I run this code, I get this error:
% codeError using solve>processString (line 337)' 1 ' is not a valid expression or equation.Error in solve>getEqns (line 267) eqns = processString(eqns, v, vc);Error in solve (line 150)[eqns,vars,options] = getEqns(varargin{:});Error in Problem_2 (line 14) solMe(i)=solve(Ae_As(i)==AeAs(i),Me(i));
Is there an easier way to do this? I've tried messing with it for hours and I'm getting nowhere.
Thanks in advance for your help!
Best Answer