From: Vyjayanthi A on
"Jan Simon" <matlab.THIS_YEAR(a)nMINUSsimon.de> wrote in message <hn2r1k$c8s$1(a)fred.mathworks.com>...
> Dear Vyjayanthi!
>
> > I am trying to solve nonlinear implicit functions using fminsearch.
> > When I execute the program I get an error of:
> > ??? Maximum recursion limit of 1 reached. Use set(0,'RecursionLimit',N)
> > to change the limit. Be aware that exceeding your available stack space can
> > crash MATLAB and/or your computer.
> > How should I minimize the above error.
>
> Please read the error message again. It tells you, that any function is called recursively again and again. Most likely this is a programming error. You can clear this by inspecting in the line, which number is shown together with the error message.
>
> Good luck, Jan

Hi Jan Simon,
I tried doing that, but I couldn't figure out where the exact error is taking place.
It says to set(0,'RecursionLimit',N).
even after I set this I get the same error message, I have been trying from past one week to solve this.Please help me out with this program.





%function b = nonlinear2(v,x1,x2,x3,x4,x5,x6)
function b = nonlinear4(v) %,x1,x2,x3,x4,x5,x6)

v=[1 1 1 -1 -1 1];

%x1=v(1);% x2=v(2); % x3=v(3); % x4=v(4); % x5=v(5);% x6=v(6); %stress ui ffic E phi rhofic

N=1;

%options=optimset('maxfunevals',1,'MaxIter',1,'TolFun',1,'TolX',1,'OutputFcn',1,'LargeScale', 'off');
%z=set(nonlinear4,'RecursionLimit',1);
%val = optimget(options,'v',1);
options=[];
a=2*0.645*10^-3;
y=2*2.34*10^-3;
rhog=8.3;
rhoc=626;
visc=170*10^-6;
Mg=1.67;
fr=1*10^-3;
ifg=2230*10^3;
Q= 1.93*10^4;
ug=0.189;
f1=0.1932;
g=9.8;
deltaht=2.4*10^-2;
x2=500;
dh=0.0038;

delta=((3*visc*Mg)/(rhoc*(rhoc-rhog)*g))^0.333;
c1=(1-2*(delta/a))/(1-(delta/a));
c2=(delta/a)/(1-(delta/a));
c3=1/(1-delta/y)*(1-delta/a);

b(1)=v(1)-(v(3)*rhog*(ug-v(2)).^2)/2;
b(2)=v(2)-((rhoc-v(6))*delta^2*g)/(2*visc)+(v(1)*delta)/visc;
b(3)=v(3)-(f1*v(4)+fr);
b(4)=v(4)-abs((v(5))/(exp(v(5))-1));
b(5)=v(5)-((2*Q)/(ifg*f1*rhog*(ug-v(2))));
b(6)=v(6)-(rhog*(c1+c2*(rhoc/rhog)-((c3*x2)/(deltaht*rhog*g))-((4*v(1))/(rhog*g*dh))));

[b, fval] = fminsearch(@nonlinear4,v,options) %,x1,x2,x3,x4,x5,x6)


From: Steven Lord on

"Jan Simon" <matlab.THIS_YEAR(a)nMINUSsimon.de> wrote in message
news:hn2r1k$c8s$1(a)fred.mathworks.com...
> Dear Vyjayanthi!
>
>> I am trying to solve nonlinear implicit functions using fminsearch.
>> When I execute the program I get an error of:
>> ??? Maximum recursion limit of 1 reached. Use set(0,'RecursionLimit',N)
>> to change the limit. Be aware that exceeding your available stack space
>> can
>> crash MATLAB and/or your computer.
>> How should I minimize the above error.
>
> Please read the error message again. It tells you, that any function is
> called recursively again and again. Most likely this is a programming
> error. You can clear this by inspecting in the line, which number is shown
> together with the error message.

I agree this may be a programming error (like Q4.15 in the newsgroup FAQ?)
but I'd also like to point out that setting the RecursionLimit to 1, as the
OP has apparently done, seems quite restrictive. With that low a recursion
limit, some functions that have a legitimate use for performing some
recursion (the quadrature routines being the first examples I can think
of -- QUAD, QUADGK, etc.) will run into this error during their normal
operation.

Being cautious is all well and good, but the default RecursionLimit is in
the hundreds, and that shouldn't (unless your machine is running with a very
small stack) cause a problem.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ