How can I solve this?

조회 수: 1 (최근 30일)
CHENG WEI LI
CHENG WEI LI 2022년 10월 23일
답변: Torsten 2022년 10월 24일
clc
clear
syms PL c k
eqn = [PL * exp(-c*exp(-k*0)) == 179323 ; PL * exp(-c*exp(-k*10)) == 203302 ; PL * exp(-c*exp(-k*20)) == 226542]
S = solve(eqn , [PL;c;k] )
S =
struct with fields:
PL: [0×1 sym]
c: [0×1 sym]
k: [0×1 sym]
  댓글 수: 2
Muhammad Usman
Muhammad Usman 2022년 10월 23일
the set of equations are non linear in nature that's why you can't use solve to compute the solution
Walter Roberson
Walter Roberson 2022년 10월 23일
The equations have no solution over reals.

댓글을 달려면 로그인하십시오.

답변 (2개)

Muhammad Usman
Muhammad Usman 2022년 10월 23일
% Solve the system of equations starting at the point [0,0,0].
% PL = x(1); c = x(2); k = x(3);
% Initial guess is [0,0,0], you can change it accordingily
fun = @root2d;
x0 = [0,0,0];
x = fsolve(fun,x0)
Warning: Trust-region-dogleg algorithm of FSOLVE cannot handle non-square systems; using Levenberg-Marquardt algorithm instead.
No solution found. fsolve stopped because the relative size of the current step is less than the value of the step size tolerance, but the vector of function values is not near zero as measured by the value of the function tolerance.
x = 1×3
1.0e+05 * 2.0192 -0.0000 0
function F = root2d(x)
F(1) = x(1) * exp(-x(2)*exp(-x(3)*0)) - 179323;
F(2) = x(1) * exp(-x(2)*exp(-x(3)*10)) - 203302;
F(2) = x(1) * exp(-x(2)*exp(-x(3)*20)) - 226542;
end
  댓글 수: 2
CHENG WEI LI
CHENG WEI LI 2022년 10월 23일
The function has correct answer.
why this answer is wrong
Alex Sha
Alex Sha 2022년 10월 24일
There are actually numerical solutions like below:
x1: 446505.431672107
x2: 0.912262916225993
x3: 0.0148006249649759

댓글을 달려면 로그인하십시오.


Torsten
Torsten 2022년 10월 24일
syms PL c k
eqn1 = PL * exp(-c*exp(-k*0)) == 179323;
eqn2 = PL * exp(-c*exp(-k*10)) == 203302;
eqn3 = PL * exp(-c*exp(-k*20)) == 226542;
sPL = solve([eqn1 eqn2],[c,k]);
Warning: Solutions are only valid under certain conditions. To include parameters and conditions in the solution, specify the 'ReturnConditions' value as 'true'.
PLsol = solve(subs(eqn3,[c,k],[sPL.c sPL.k]),PL);
sck = solve([subs(eqn1,PL,PLsol),subs(eqn2,PL,PLsol)],[c,k]);
csol = sck.c;
ksol = sck.k;
vpa(PLsol)
ans = 
446505.43167210849515476976968181
vpa(csol)
ans = 
0.91226291622599614437018856917074
vpa(ksol)
ans = 
0.014800624964975891465693800088887

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by