When I use vpasolve I get all variables as [0x1 sym], any input as to what the problem might be would be appreciated!

조회 수: 5 (최근 30일)
syms M2 M3 beta1 beta2 beta3
M1 = 2.4;
M4 = 1.3;
Gamma = 1.4;
Gamma_P = Gamma+1;
Gamma_M = Gamma-1;
%Mach #'s upstream of normal shock
Mn1 = M1*sind(beta1);
Mn2 = M2*sind(beta2);
Mn3 = M3*sind(beta3);
%Deflection Angles
theta1 = atand(2*(cotd(beta1))*(((M1^2)*(sind(beta1))^2)-1)/((2+((M1^2)*(Gamma+cosd(2*beta1))))));
theta2 = atand(2*(cotd(beta2))*(((M2^2)*(sind(beta2))^2)-1)/((2+((M2^2)*(Gamma+cosd(2*beta2))))));
theta3 = atand(2*(cotd(beta3))*(((M1^2)*(sind(beta3))^2)-1)/((2+((M3^2)*(Gamma+cosd(2*beta3))))));
% Mach #'s
M2x = ((sqrt(((Mn1^2*Gamma_M)+2)/((2*Gamma*Mn1^2)-Gamma_M))))/(sind((beta1)-(theta1)));
M3x = ((sqrt(((Mn2^2*Gamma_M)+2)/((2*Gamma*Mn2^2)-Gamma_M))))/(sind((beta2)-(theta2)));
M4x = ((sqrt(((Mn3^2*Gamma_M)+2)/((2*Gamma*Mn3^2)-Gamma_M))))/(sind((beta3)-(theta3)));
solve = vpasolve([Mn1==Mn2, Mn1==Mn3, M2==M2x, M3==M3x],[beta1 beta2 beta3 M2 M3],[10 20 17 4.2 3.5])

채택된 답변

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023년 1월 15일
The problem here is that you have defined 4 equations and trying to solve for 5 unknowns (beta1, beta2 beta3 M2, M3) that is incompatible. Thus, one of the unknowns to be known/defined. Here is corrected code with this alteration.
syms M3 beta1 beta2 beta3
M1 = 2.4;
M2 = 4.2; % Defined and M3 remains as unknown
M4 = 1.3;
Gamma = 1.4;
Gamma_P = Gamma+1;
Gamma_M = Gamma-1;
%Mach #'s upstream of normal shock
Mn1 = M1*sind(beta1);
Mn2 = M2*sind(beta2);
Mn3 = M3*sind(beta3);
%Deflection Angles
theta1 = atand(2*(cotd(beta1))*(((M1^2)*(sind(beta1))^2)-1)/((2+((M1^2)*(Gamma+cosd(2*beta1))))));
theta2 = atand(2*(cotd(beta2))*(((M2^2)*(sind(beta2))^2)-1)/((2+((M2^2)*(Gamma+cosd(2*beta2))))));
theta3 = atand(2*(cotd(beta3))*(((M1^2)*(sind(beta3))^2)-1)/((2+((M3^2)*(Gamma+cosd(2*beta3))))));
% Mach #'s
M2x = ((sqrt(((Mn1^2*Gamma_M)+2)/((2*Gamma*Mn1^2)-Gamma_M))))/(sind((beta1)-(theta1)));
M3x = ((sqrt(((Mn2^2*Gamma_M)+2)/((2*Gamma*Mn2^2)-Gamma_M))))/(sind((beta2)-(theta2)));
M4x = ((sqrt(((Mn3^2*Gamma_M)+2)/((2*Gamma*Mn3^2)-Gamma_M))))/(sind((beta3)-(theta3)));
solve = vpasolve([Mn1==Mn2, Mn1==Mn3, M2==M2x, M3==M3x],[beta1 beta2 beta3 M3],[10 20 17 3.5])
solve = struct with fields:
beta1: 12.42307001044589696233406591853 beta2: 7.0612666759489129181951376213411 beta3: 4.5351783118604105328130018107605 M3: 6.5296692049177007004148130266163

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by