Solve of implicity equations
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (2 件)
Torsten
2023 年 3 月 24 日
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 件のコメント
John D'Errico
2023 年 3 月 24 日
編集済み: John D'Errico
2023 年 3 月 24 日
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 件のコメント
Walter Roberson
2023 年 3 月 24 日
I was confirming your "near 5" for the peak, and showing it is not nearly a zero.
参考
カテゴリ
Help Center および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!