Solve of implicity equations

1 visualizzazione (ultimi 30 giorni)
Samuel Arispe
Samuel Arispe il 24 Mar 2023
Commentato: Walter Roberson il 24 Mar 2023
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?

Risposte (2)

Torsten
Torsten il 24 Mar 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 il 24 Mar 2023
Modificato: John D'Errico il 24 Mar 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 Commenti
John D'Errico
John D'Errico il 24 Mar 2023
But, apparently, a negative root.
Walter Roberson
Walter Roberson il 24 Mar 2023
I was confirming your "near 5" for the peak, and showing it is not nearly a zero.

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by