How to solve unique positive root
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I want to find the unique positive root. This is my current code. The result that i get contains imaginary numbers, that is not what i want.
Is there a solution for this?
------------------------------------------------------------------------------------------------------
d(1) = 0.95;
e(1) = 0.65;
interest = 0.05;
y = 0.02;
r = 0.37;
alpha = ((interest - y)/(1 + interest)) + 1;
%Calculating gamma, constant
syms gamma i x;
S1 = symsum((gamma^i)*(alpha^i), i, 1, 15); %Summation 1
S2 = symsum((alpha^i), i, 0, 15-1); %Summation 2
eqn = (S1 - ((0.6 - d(1)*(alpha^15) + r*S2) / e(1))) == 0;
solgamma = solve(eqn,gamma);
solgamma
vpa(solgamma)
1 Kommentar
madhan ravi
am 11 Apr. 2019
Bearbeitet: madhan ravi
am 11 Apr. 2019
Trying adding an assumption to the variable that your trying to solve. Also don’t name a variable gamma it may shadow the in-built function gamma().
Antworten (1)
Torsten
am 11 Apr. 2019
d(1) = 0.95;
e(1) = 0.65;
interest = 0.05;
y = 0.02;
r = 0.37;
alpha = ((interest - y)/(1 + interest)) + 1;
fun = @(gamma)alpha*gamma.*((alpha*gamma).^15-1)./(alpha*gamma-1)-(0.6-d(1)*alpha^15+r*(alpha^15-1)/(alpha-1))/e(1);
x0 = [0.9,0.95];
sol = fzero(fun,x0)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Calculus finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!