Solve of implicity equations
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hola que tal, estoy ralizando esta ejecución pero mi variables de interés da NaN
alpha = 0.14; A = 3300; n = 0.01 ; b_2019 = 69100; rho = 0.02
uno_alpha_A = ((1-alpha)*A)
dos_rho = (2+rho)
uno_n = (1+n)
uno_rho = (1+rho)
alpha_A = (alpha*A)
alpha_uno = (alpha-1)
fcn = @(K) (uno_alpha_A*K^(alpha))/(dos_rho*uno_n)-((1+uno_rho*(1+alpha_A*K^alpha_uno)^(-1))/(dos_rho*uno_n))*b_2019 - K;
sols = fzero(fcn, 1)
Alguien me podría a yudar a solucionar este percance, por favor?
0 Kommentare
Antworten (2)
Torsten
am 24 Mär. 2023
You should first check whether a zero of your function really exists. It doesn't seem to be the case:
alpha = 0.14; A = 3300; n = 0.01 ; b_2019 = 69100; rho = 0.02
uno_alpha_A = ((1-alpha)*A)
dos_rho = (2+rho)
uno_n = (1+n)
uno_rho = (1+rho)
alpha_A = (alpha*A)
alpha_uno = (alpha-1)
fcn = @(K) (uno_alpha_A*K.^(alpha))./(dos_rho*uno_n)-((1+uno_rho*(1+alpha_A*K.^alpha_uno).^(-1))./(dos_rho*uno_n))*b_2019 - K;
K = 0:0.1:10;
plot(K,fcn(K))
0 Kommentare
John D'Errico
am 24 Mär. 2023
Bearbeitet: John D'Errico
am 24 Mär. 2023
alpha = 0.14; A = 3300; n = 0.01 ; b_2019 = 69100; rho = 0.02;
uno_alpha_A = ((1-alpha)*A);
dos_rho = (2+rho);
uno_n = (1+n);
uno_rho = (1+rho);
alpha_A = (alpha*A);
alpha_uno = (alpha-1);
fcn = @(K) (uno_alpha_A*K^(alpha))/(dos_rho*uno_n)-((1+uno_rho*(1+alpha_A*K^alpha_uno)^(-1))/(dos_rho*uno_n))*b_2019 - K;
Sometimes, a symbolic expression can be easier to look at.
syms k
fcn(k)
So we have an expression with powers of k. I suppose it might have a solution. Try plotting it. A basic rule is to ALWAYS PLOT EVERYTHING. And then, plot something else if you can find anything else to plot. Think about what you see.
fplot(fcn,[0,100000])
And that shows no solution so far. It seems to be going asymptotically linearly to -inf for large k. And that makes sense. So I'll narrow the range.
fplot(fcn,[0,100])
That still is going nowhere near zero. I'll narrow the range again.
fplot(fcn,[0,20])
It seems clear this has a maximum value for positive K around K==5, but t is still very far away from zero.
There appear to be no positive solutions. And any negative solutions will generate complex results.
So the failure of fzero to find a root just tells you there is no root.
3 Kommentare
Walter Roberson
am 24 Mär. 2023
I was confirming your "near 5" for the peak, and showing it is not nearly a zero.
Siehe auch
Kategorien
Find more on Applications in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!