How to solve a five equations systems to get the five unknown
35 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have my code that i wrote to solve a system of 5 equations in which there is five unknown. I'm trying to get an expression for five of those variables. The functions in the equation are quite complex and i don't think its doable by hand. However when i try to run my code the output is not what i expect to get
Here is my code :
clc; clear all; close all;
syms alpha_inf phi sigma lambda V;
syms T_1_exp T_2_exp T_3_exp T_4_exp T_5_exp;
syms theta_1 theta_2 theta_3 theta_4 theta_5;
syms E_0(theta);
syms coeff_transmission(theta);
syms gamma;
omega = 2*pi*1e5;
syms l;
c_0 = 340;
syms nu;
rho_0 = 1.2;
P_r = 0.07;
delta = sqrt(nu/(omega*rho_0));
A = alpha_inf*(1/lambda)*(1 + (gamma - 1)/(3*sqrt(P_r))) ;
B_1 = alpha_inf*((gamma - 1)/(3*lambda*P_r) +4*(gamma - 1)/(3*sigma^2*sqrt(P_r)) + 3/sigma) ;
B_2 = 4*alpha_inf^2*(1/lambda)*(1 + (gamma - 1)/(3*sqrt(P_r))) ;
C_1 = alpha_inf*((15/(4*V))*((gamma-1)/(27*P_r) +1) + (6*(gamma-1)/(3*sigma*lambda))*(1/(3*P_r) + 1/sqrt(P_r)));
C_2 = alpha_inf^2*(1/lambda)*(1 + (gamma - 1)/(3*sqrt(P_r)))*((gamma - 1)/(3*lambda*P_r) ...
+4*(gamma - 1)/(3*sigma^2*sqrt(P_r)) + 3/sigma);
C_3 = alpha_inf^3*((1/lambda)*(1 + (gamma - 1)/(3*sqrt(P_r))))^3;
C_4 = C_2;
E_0(theta) = phi*sqrt(alpha_inf - sin(theta)^2)/(cos(theta)*alpha_inf);
coeff_transmission(theta) = abs(4*E_0(theta)/(1 + E_0(theta))^2)*exp(-(omega*l/(2*c_0))*sqrt(2)*delta*(A/sqrt(alpha_inf - sin(theta)^2)) ...
- nu*l/(2*c_0*rho_0)*(B_1/sqrt(alpha_inf - sin(theta)^2) ...
- B_2/(8*sqrt(alpha_inf - sin(theta)^2)^3)) ...
- (omega*l*sqrt(2)/(2*c_0))*delta^3*(C_1/(2*sqrt(alpha_inf - sin(theta)^2)) ...
- C_2/(12*sqrt(alpha_inf - sin(theta)^2)^3) ...
+ C_3/(4*sqrt(alpha_inf - sin(theta)^2)^5) ...
- C_4/(24*sqrt(alpha_inf - sin(theta)^2)^5)));
eqns = [T_1_exp == coeff_transmission(theta_1), T_2_exp == coeff_transmission(theta_2), T_3_exp == coeff_transmission(theta_3), T_4_exp == coeff_transmission(theta_4), T_5_exp == coeff_transmission(theta_5)];
assume(alpha_inf>0 & phi>=0 & phi<=1 )
s = solve(eqns, [alpha_inf, phi, lambda, sigma, V],'IgnoreAnalyticConstraints', true, 'ReturnConditions',true);
disp(s)
And here is the output :
alpha_inf: z3
phi: z4
lambda: z5
sigma: z6
V: z7
parameters: [z3 z4 z5 z6 z7]
conditions: T_1_exp - (4*exp(- (l*nu*((z3*(3/z6 + (100*(gamma - 1))/(21*z5) + (10*7^(1/2)*…
Does anyone know why it doesn't give me an expression for my unknown and if it is even possible to do
3 Commenti
Star Strider
il 5 Dic 2024 alle 13:38
syms alpha_inf phi sigma lambda V;
syms T_1_exp T_2_exp T_3_exp T_4_exp T_5_exp;
syms theta_1 theta_2 theta_3 theta_4 theta_5;
syms E_0(theta);
syms coeff_transmission(theta);
syms gamma;
omega = 2*pi*1e5;
syms l;
c_0 = 340;
syms nu;
rho_0 = 1.2;
P_r = 0.07;
delta = sqrt(nu/(omega*rho_0));
A = alpha_inf*(1/lambda)*(1 + (gamma - 1)/(3*sqrt(P_r))) ;
B_1 = alpha_inf*((gamma - 1)/(3*lambda*P_r) +4*(gamma - 1)/(3*sigma^2*sqrt(P_r)) + 3/sigma) ;
B_2 = 4*alpha_inf^2*(1/lambda)*(1 + (gamma - 1)/(3*sqrt(P_r))) ;
C_1 = alpha_inf*((15/(4*V))*((gamma-1)/(27*P_r) +1) + (6*(gamma-1)/(3*sigma*lambda))*(1/(3*P_r) + 1/sqrt(P_r)));
C_2 = alpha_inf^2*(1/lambda)*(1 + (gamma - 1)/(3*sqrt(P_r)))*((gamma - 1)/(3*lambda*P_r) ...
+4*(gamma - 1)/(3*sigma^2*sqrt(P_r)) + 3/sigma);
C_3 = alpha_inf^3*((1/lambda)*(1 + (gamma - 1)/(3*sqrt(P_r))))^3;
C_4 = C_2;
E_0(theta) = phi*sqrt(alpha_inf - sin(theta)^2)/(cos(theta)*alpha_inf);
coeff_transmission(theta) = abs(4*E_0(theta)/(1 + E_0(theta))^2)*exp(-(omega*l/(2*c_0))*sqrt(2)*delta*(A/sqrt(alpha_inf - sin(theta)^2)) ...
- nu*l/(2*c_0*rho_0)*(B_1/sqrt(alpha_inf - sin(theta)^2) ...
- B_2/(8*sqrt(alpha_inf - sin(theta)^2)^3)) ...
- (omega*l*sqrt(2)/(2*c_0))*delta^3*(C_1/(2*sqrt(alpha_inf - sin(theta)^2)) ...
- C_2/(12*sqrt(alpha_inf - sin(theta)^2)^3) ...
+ C_3/(4*sqrt(alpha_inf - sin(theta)^2)^5) ...
- C_4/(24*sqrt(alpha_inf - sin(theta)^2)^5)));
eqns = [T_1_exp == coeff_transmission(theta_1), T_2_exp == coeff_transmission(theta_2), T_3_exp == coeff_transmission(theta_3), T_4_exp == coeff_transmission(theta_4), T_5_exp == coeff_transmission(theta_5)];
assume(alpha_inf>0 & phi>=0 & phi<=1 )
s = solve(eqns, [alpha_inf, phi, lambda, sigma, V],'IgnoreAnalyticConstraints', true, 'ReturnConditions',true);
% disp(s)
disp("Conditions: ")
pretty(vpa(simplify(s.conditions, 500), 5))
.
Risposte (1)
Torsten
il 5 Dic 2024 alle 16:05
Modificato: Torsten
il 5 Dic 2024 alle 16:06
Directly use the five experimental values (T_exp,theta) as numerical data and "lsqcurvefit" or "fmincon" to solve for the five unknowns.
But note that the measurement data must be very precise to get physically senseful values for the unknown parameters alpha_inf, phi, lambda, sigma, V. It would be better if you had more than five measurements.
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!