Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: One or more output arguments not assigned during call
Date: Wed, 14 Aug 2013 19:39:21 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 114
Message-ID: <kugmd9$l2l$1@newscl01ah.mathworks.com>
References: <ku883j$n4p$1@newscl01ah.mathworks.com> <kudtbu$fr3$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1376509161 21589 172.30.248.37 (14 Aug 2013 19:39:21 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 14 Aug 2013 19:39:21 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 3391687
Xref: news.mathworks.com comp.soft-sys.matlab:800902

"Steven_Lord" <slord@mathworks.com> wrote in message <kudtbu$fr3$1@newscl01ah.mathworks.com>...
> 
> 
> "Sanaa " <findingsanaa@yahoo.com> wrote in message 
> news:ku883j$n4p$1@newscl01ah.mathworks.com...
> > Hi all,
> > I have a problem when plotting the bifurcation diagram of the 
> > fractional-order duffing equation
> > my code for that is
> > function [T, Y]=FODuffing(parameters, orders, TSim, Y0)
> > h=0.01;
> > % number of calculated mesh points:
> > n=round(TSim/h);
> > %orders of derivatives, respectively:
> > q1=orders(1); q2=orders(2); q3=orders(3);
> > % constants of financial system:
> > % mu=parameters(1);
> 
> Because this line is commented out, there is NO indication whatsoever that 
> tells MATLAB that you intend mu to be a variable in this function's 
> workspace. Therefore when MATLAB tries to figure out what mu is on this 
> later line:
> 
> *snip*
> 
> > z(i)=(-mu*y(i-1)-lambda*x(i-1)-b*x(i-1)^3+gama*sin(omega))*h^q3 - memo(z, 
> > c3, i);
> 
> it looks to see if there is a function named mu. There is, so MATLAB decides 
> that this reference to mu must be a call to that function with 0 input 
> arguments.
> 
> *snip*
> 
> I assume this is a separate script file or this code is being run in the 
> MATLAB Command Window.
> 
> > close all; clear all;
> 
> There's no real need to do this, and it will interfere with debugging your 
> code because the CLEAR ALL will clear breakpoints.
> 
> > for mu=0:0.001:4
> 
> This defines the variable mu IN THIS WORKSPACE. The variable mu defined here 
> is NOT "visible" to any other workspace. That's the whole point behind 
> workspaces; what you do in one workspace generally doesn't affect what 
> happens in other workspaces.
> 
> > [t, y]=FODuffing([-1 1 0.6 1],[0.95 0.05 1],100, [0 0 0]);
> 
> When you move from this workspace into FODuffing's workspace, you lose 
> access to the mu variable defined in THIS workspace, but you gain access to 
> any variables defined in THAT workspace.
> 
> *snip*
> 
> > %%%%%%%%%%%
> > I get the error
> > ??? One or more output arguments not assigned during call to 
> > 'C:\MATLAB7\toolbox\mutools\commands\mu.m (mu)'.
> 
> The MU function expects to be called with input arguments; when it is not it 
> does not respond correctly.
> 
> > Error in ==> FODuffing at 24
> > z(i)=(-mu*y(i-1)-lambda*x(i-1)-b*x(i-1)^3+gama*sin(omega))*h^q3 - memo(z, 
> > c3, i);
> >
> > Error in ==> system1 at 3
> > [t, y]=FODuffing([-1 1 0.6 1],[0.95 0.05 1],100, [0 0 0]);
> >
> > I want to loop over mu that's why I didn't specify a value for it in the 
> > function file!
> 
> Then you need to pass the value of mu from the workspace that contains the 
> FOR loop into the workspace of the FODuffing function. The easiest way to do 
> that is to pass it as an input by modifying the definition of the function:
> 
> function [T, Y]=FODuffing(parameters, orders, TSim, Y0, mu)
> % snip the remainder of the definition of FODuffing
> 
> and modifying how you call it:
> 
> for mu=0:0.001:4
>     [t, y]=FODuffing([-1 1 0.6 1],[0.95 0.05 1],100, [0 0 0], mu);
> end
> 
> > What went wrong please?
> 
> Please read through this documentation on function workspaces and the 
> information about sharing information between workspaces to which it links.
> 
> http://www.mathworks.com/help/matlab/matlab_prog/base-and-function-workspaces.html
> 
> -- 
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on 
> http://www.mathworks.com 
Thanks a lot for your valuable comments. I guess the code is running correctly now, however, I have one question concerning the figure I got; it's just a vertical line from the values I specified for mu. when plotting bifurcation diagrams for discrete maps, I should through out some values of x from the plot
Please see this simple code:
itermax=300;min=itermax-9;% That is we plot from 291:300 i.e. 10 values of x only.
for rho=2.5:0.001:4
     x(1)=0.1;x(2)=0.3;
    for i=2:itermax-1
        x(i+1)=x(i)+rho*x(i)*(1-x(i-1));
end
plot(rho*ones(10),x(min:itermax),'b.','linewidth',0.1)
hold on
end

But I don't know how to do the same in my code. Should I set the same counters ?
I really appreciate your help.