How to find L from the given code?

1 view (last 30 days)
Akhtar Jan
Akhtar Jan on 30 Jul 2022
Edited: Torsten on 30 Jul 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;

Accepted Answer

Torsten
Torsten on 30 Jul 2022
Edited: Torsten on 30 Jul 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))

More Answers (1)

Walter Roberson
Walter Roberson on 30 Jul 2022
Edited: Torsten on 30 Jul 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

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Tags

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!