Hey all, I want to solve for following non linear system of equations:
I have only 3 unknown: k=x(1); F=x(2); epsilon= x(3); And the corresponding nonlinear system of equations is :
Equation 1: 0.94=[(k^2+1)*epsilon-2*F]/[(k^2-1)*epsilon]Equation 2: F=(pi/2)*summation n varies from 0 to inf {[(2n!)/(2^(2n)*(n!)^2)]^2}*[k^(2n)]Equation 3: epsilon=(pi/2)*summation n varies from 0 to inf {[(2n!)/(2^(2n)*(n!)^2)]^2}*[k^(2n)]/(1-2n)
To solve for this I have written following code:
function F = myfun(x)curvediff=0.94;n=0:1:10e3;N1=factorial(2.*n);D1=2.^(2.*n);D2=factorial(n).^2;ND=N1./(D1.*D2);PI=ND.*ND;PII=PI./(1-2.*n);EI=PI.*x(1).^(2.*n);EII=PII.*x(1).^(2.*n);F=[curvediff-((x(1)*x(1)+1)*x(3)-2*x(2))/((x(1)*x(1)-1)*x(3));x(2)-pi/2.*sum(EI); x(3)-pi/2.*sum(EII)];
And when I try to solve for this I am getting following error :
>> x0=[9.347;5;1.02];>> x=fsolve(@myfun,x0);??? Error using ==> trustnleqn at 28Objective function is returning undefined values atinitial point. FSOLVE cannot continue.Error in ==> fsolve at 366 [x,FVAL,JACOB,EXITFLAG,OUTPUT,msgData]=...
Kindly help me to debug this error. Thanks in advance.
Nikhil
Best Answer