How do i plot this solutions?

1 vue (au cours des 30 derniers jours)
Benneth Perez
Benneth Perez le 26 Oct 2021
Hello,
I want to plot the theta2 values on the x and presures (P2_ALL) on a plot. It seems my pressures are in symbolic form so Im using fplot to plot. When I do this it gives me an error. Does anyone know how to fix this?
clc; clearvars
format short g
M1 = 3 ;
P1 = 1 ;
theta2 = 1:1:30 ;
gamma = 1.4 ;
phi = 4.8 ;
syms beta2
tantheta2 = tand(theta2 );
x = 2*cotd(beta2)*((M1^2*((sind(beta2)).^2)-1 ));
y = M1^2*(gamma+cosd(2*beta2))+2 ;
eqn2 = x/y ;
b0=1 ;
for ii=1:numel(theta2 )
T = tantheta2(ii );
clearvars result2
syms beta2
result2 = vpasolve(T== eqn2, beta2,b0 );
beta2 = vpa(result2 );
Mn1 = M1*sind(beta2); % Eqn 4.7 from Anderson's
p2p1 = 1+((2*gamma)/(gamma+1))*(Mn1^2-1); % Eqn 4.9 from Anderson's
Mn2sq= (Mn1^2+(2/(gamma-1)))/((2*gamma/(gamma-1))*Mn1^2-1);% Eqn 4.10 from Anderson's
Mn2 = sqrt(Mn2sq );
M2 = Mn2/sind(beta2-theta2(ii ));
P2 = p2p1*P1 ;
P2_ALL{ii}=vpa(P2) ;
end
fplot(theta2,P2_ALL)
Error using char
Cell elements must be character arrays.

Error in fplot (line 144)
strArgs = char(args{k});

Réponses (0)

Catégories

En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by