Solve of implicity equations

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?

Respuestas (2)

Torsten
Torsten el 24 de Mzo. de 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
rho = 0.0200
uno_alpha_A = ((1-alpha)*A)
uno_alpha_A = 2838
dos_rho = (2+rho)
dos_rho = 2.0200
uno_n = (1+n)
uno_n = 1.0100
uno_rho = (1+rho)
uno_rho = 1.0200
alpha_A = (alpha*A)
alpha_A = 462.0000
alpha_uno = (alpha-1)
alpha_uno = -0.8600
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))
John D'Errico
John D'Errico el 24 de Mzo. de 2023
Editada: John D'Errico el 24 de Mzo. de 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)
ans = 
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])
Warning: Function behaves unexpectedly on array inputs. To improve performance, properly vectorize your function to return an output with the same size and shape as the input arguments.
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])
Warning: Function behaves unexpectedly on array inputs. To improve performance, properly vectorize your function to return an output with the same size and shape as the input arguments.
That still is going nowhere near zero. I'll narrow the range again.
fplot(fcn,[0,20])
Warning: Function behaves unexpectedly on array inputs. To improve performance, properly vectorize your function to return an output with the same size and shape as the input arguments.
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 comentarios

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;
syms k
F = fcn(k)
F = 
criticals = solve(diff(F,k),k, 'returnconditions', true)
criticals = struct with fields:
k: z2^50 parameters: z2 conditions: z2^129 + (7439124*z2^86)/10201 + (341723844*z2^43)/10201 + (140019541200*z2^36)/10201 - 424027850400/10201 == 0 & -pi/50 < angle(z2) & angle(z2) <= pi/50
best = vpasolve(diff(F,k),k,5)
best = 
4.6384218721011299497817383048764
subs(F,k,best)
ans = 
limit(F,k,0), vpa(ans)
ans = 
ans = 
John D'Errico
John D'Errico el 24 de Mzo. de 2023
But, apparently, a negative root.
Walter Roberson
Walter Roberson el 24 de Mzo. de 2023
I was confirming your "near 5" for the peak, and showing it is not nearly a zero.

Iniciar sesión para comentar.

Preguntada:

el 24 de Mzo. de 2023

Comentada:

el 24 de Mzo. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by