Using vpasolve in a for loop ERROR
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying to solve for the variable M given the values of v2. V2 is a 1x100 and I am looking for the value of M given each one of these V2. I tried implementing a for loop but I ended up with a 1x1 M instead of a 1x100.
syms M
M1=1.5;
gamma=1.4;
alpha=linspace(0,13); %theta max is 13 degrees
%must find M using Prantl-meyer expansion
v1=sqrt((gamma+1)/(gamma-1))*atan(sqrt((.4/2.4)*(M1^2-1)))-atan(sqrt(M1^2-1));
v1=v1*180/pi;
v2=v1+alpha;
for i =length(v2)
v2(i)=v1+alpha(i);
PM=(sqrt((gamma+1)/(gamma-1))*atan(sqrt(((gamma-1)/(gamma+1))*((M^2)-1)))-atan(sqrt((M^2)-1)))*180/pi==v2(i);
solM(i)=vpasolve(PM,M);
end
0 Kommentare
Antworten (1)
Yasasvi Harish Kumar
am 28 Mär. 2019
Hi,
You have an error in your for loop definition and in using vpasolve. I think this should solve it.
syms M
gamma=1.4;
alpha=linspace(0,13); %theta max is 13 degrees
%must find M using Prantl-meyer expansion
v1=sqrt((gamma+1)/(gamma-1))*atan(sqrt((.4/2.4)*(M1^2-1)))-atan(sqrt(M1^2-1));
v1=v1*180/pi;
v2=v1+alpha;
for i =1:length(v2)
v2(i)=v1+alpha(i);
PM=(sqrt((gamma+1)/(gamma-1))*atan(sqrt(((gamma-1)/(gamma+1))*((M^2)-1)))-atan(sqrt((M^2)-1)))*180/pi==v2(i);
solM(i)=vpasolve(PM,M);
end
M = 1.5;
solution = eval(solM);
Regards
1 Kommentar
Siehe auch
Kategorien
Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!