How to find L from the given code?

4 vues (au cours des 30 derniers jours)
Akhtar Jan
Akhtar Jan le 30 Juil 2022
Modifié(e) : Torsten le 30 Juil 2022
clc
close all
lags = 0.6;
k1 = 3;
k_1 = 1;
k2 = 2.5;
k3 = 1;
k_3 = 1;
k4 = 2;
k5 = 1;
E1 = 1;
E2 = 2;
K1 = (k_1+k2)/k1;
K2 = (k_3+k4)/k3;
k3*E2*(L^2+L*(k1*K1+k4+k1*E1)+(E1+K1)*k1*k4+k1*k2*E1)+(L+k3*K2)*(k1*k2*E1+(L+k1*K1+k1*E1)*(L-k5*E1*e^(-L*lags))) = 0;

Réponse acceptée

Torsten
Torsten le 30 Juil 2022
Modifié(e) : Torsten le 30 Juil 2022
lags = 0.6;
k1 = 3;
k_1 = 1;
k2 = 2.5;
k3 = 1;
k_3 = 1;
k4 = 2;
k5 = 1;
E1 = 1;
E2 = 2;
K1 = (k_1+k2)/k1;
K2 = (k_3+k4)/k3;
fun = @(L) k3*E2*(L.^2+L.*(k1*K1+k4+k1*E1)+(E1+K1)*k1*k4+k1*k2*E1)+(L+k3*K2).*(k1*k2*E1+(L+k1*K1+k1*E1).*(L-k5*E1*exp(-L*lags)));
L0 = -1.5;
L1 = fsolve(fun,L0)
Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient.
L1 = -1.6620
L0 = -2.5;
L2 = fsolve(fun,L0)
Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient.
L2 = -2.4088
plot((-2.5:0.1:-1),fun(-2.5:0.1:-1))
  1 commentaire
Akhtar Jan
Akhtar Jan le 30 Juil 2022
Thanks alot sir

Connectez-vous pour commenter.

Plus de réponses (1)

Walter Roberson
Walter Roberson le 30 Juil 2022
Modifié(e) : Torsten le 30 Juil 2022
syms L
e = exp(sym(1))
e = 
e
lags = 0.6;
k1 = 3;
k_1 = 1;
k2 = 2.5;
k3 = 1;
k_3 = 1;
k4 = 2;
k5 = 1;
E1 = 1;
E2 = 2;
K1 = (k_1+k2)/k1;
K2 = (k_3+k4)/k3;
eqn = k3*E2*(L^2+L*(k1*K1+k4+k1*E1)+(E1+K1)*k1*k4+k1*k2*E1)+(L+k3*K2)*(k1*k2*E1+(L+k1*K1+k1*E1)*(L-k5*E1*e^(-L*lags)))
eqn = 
vpasolve(eqn)
ans = 
There is a second solution near -2.3
  2 commentaires
Akhtar Jan
Akhtar Jan le 30 Juil 2022
thank you sir
Akhtar Jan
Akhtar Jan le 30 Juil 2022
this one is also helpfull

Connectez-vous pour commenter.

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Tags

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by