Error when solving symbolic equation in nested for loop
Mostra commenti meno recenti
I am trying to solve a symbolic equation for b in a nested as shown below but i am getting the following error:
Error in solve (line 226)
[eqns,vars,options] = getEqns(varargin{:});
Error in Problem_1 (line 20)
s1=solve(tand(t(j))==2*cotd(b).*((M1(i).^2*sind(b).^2-1)./(M1(i).^2*(G+cosd(2*b))+2)),b); %solve for beta
Here is the code:
clc
clear
syms b x
M1 = [1.6,1.8,2.0,2.2,2.6,3.2,4.0];
t = [0,8,16,24,32,40];
%M1 = 6; %Mach number M1
%t = 6; %Deflection angle theta
G = 1.4; %gamma
M = numel(M1); %Number of Mach 1 elements
T = numel(t); %Number of theta elements
Mach2 = zeros(M,T); %Matrix for M2
P_rat = zeros(M,T); %Matrix for Pressure ratio
for i=1:M
for j=1:T
s1=solve(tand(t(j))==2*cotd(b).*((M1(i).^2*sind(b).^2-1)./(M1(i).^2*(G+cosd(2*b))+2)),b); %solve for beta
b = double(s1)+180; %beta
end
end
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Common Operations in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!