I am pretty new to Octave and I need some help figuring out a code.
I wrote this code:
function y = f(x)
y = zeros(2,1);
a = 1 + x(1)^2/(P1*nu1)*(1-x(2));
b = -mu2 + (1 - mu2^2 + E)/(x(2) - mu2);
c = -x(1)^2/(P1*nu1);
d = -(1 - mu2^2 + E)/((x(2) - mu2)^2);
y(1) = a - b ;
y(2) = c - d ;
And then used:
[x, fval, info] = fsolve (@f, [1;2])
to solve for x(1) and x(2) when a = b and c = d (where c and d are respective derivatives of a and b).
I know that the x values are supposed to be x(1)=1000 and x(2)=0.5, as I previously solved this system by hand. However, fsolve gives me:
Is there anything I can do to improve he code so that it gives the correct answers, or something close?