MATLAB: Vpasolve with an array

vpasolve

Hi all,
I was wondering if I could solve for p3 with a given array.
For example,
x1 = 1:0.01:14;
% or x1 = linspace(1,14,0.01)
syms p3
S = vpasolve(p3*(1 -((gamma-1)*(p3-1))./(2*gamma*(2*gamma+(gamma+1)*(p3-1))).^.5).^(-2.*gamma./(gamma-1))-1 == x1, p3)
% and with given p3 array, I should get Ms = sqrt((gamma+1)/(2.*gamma))*(p3-1)+1, then I need to plot(x1,Ms) so that
% I could get a continuous curve.
but, it gives me this error (More equations than variables is only supported for polynomial systems.)
What can I possibly fx for this?

Best Answer

Thank you.
I have successfully solved Ms, but the thing is I have to obtain Mr as well.
I have used the exact same formula that you have provided to me,
x1 = linspace(1,14,1000);
P3G = 3; %initial guess
gamma = 1.4;
S = arrayfun(@(X) fzero(@(p3) p3*(1 -((gamma-1)*(p3-1))./sqrt(2*gamma*(2*gamma+(gamma+1)*(p3-1)))).^(-2.*gamma./(gamma-1)) - X, P3G), x1);
Ms = (((gamma+1)/(2.*gamma))*(S-1)+1).^0.5;
% So far, it is good. I gain S and Ms Matrix.
% But, I need to plug in Ms array to gain Mr.
S1 = arrayfun(@(X) fzero(@(Mr) ((Ms.*(Mr.^2-1))/(Ms.^2-1))*((1+((2.*(gamma-1)*(Ms.^2-1)))./(gamma+1)^2).*(gamma+1./Ms.^2)).^.5 - Mr - X, P3G), Ms);
...
it gives me "Operands to the || and && operators must be convertible to logical scalar values".
%I am trying to find Mr arrays with respect to Ms.
Related Question