How to find L from the given code?

4 visualizaciones (últimos 30 días)
Akhtar Jan
Akhtar Jan el 30 de Jul. de 2022
Editada: Torsten el 30 de Jul. de 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;

Respuesta aceptada

Torsten
Torsten el 30 de Jul. de 2022
Editada: Torsten el 30 de Jul. de 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))

Más respuestas (1)

Walter Roberson
Walter Roberson el 30 de Jul. de 2022
Editada: Torsten el 30 de Jul. de 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 comentarios
Akhtar Jan
Akhtar Jan el 30 de Jul. de 2022
thank you sir
Akhtar Jan
Akhtar Jan el 30 de Jul. de 2022
this one is also helpfull

Iniciar sesión para comentar.

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by