MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

# Thread Subject: One or more output arguments not assigned during call

 Subject: One or more output arguments not assigned during call From: Sanaa Date: 11 Aug, 2013 14:46:11 Message: 1 of 12 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); lambda=parameters(1); b=parameters(2); gama=parameters(3); omega=parameters(4); % binomial coefficients calculation: cp1=1; cp2=1; cp3=1; for j=1:n c1(j)=(1-(1+q1)/j)*cp1; c2(j)=(1-(1+q2)/j)*cp2; c3(j)=(1-(1+q3)/j)*cp3; cp1=c1(j); cp2=c2(j); cp3=c3(j); end % initial conditions setting: x(1)=Y0(1); y(1)=Y0(2); z(1)=Y0(3); % calculation of phase portraits /numerical solution/: for i=2:n x(i)=y(i-1)*h^q1 - memo(x, c1, i); y(i)=z(i-1)*h^q2 - memo(y, c2, i); z(i)=(-mu*y(i-1)-lambda*x(i-1)-b*x(i-1)^3+gama*sin(omega))*h^q3 - memo(z, c3, i); end for j=1:n Y(j,1)=x(j); Y(j,2)=y(j); Y(j,3)=z(j); end T=0:h:TSim; %%%%%%%%% close all; clear all; for mu=0:0.001:4 [t, y]=FODuffing([-1 1 0.6 1],[0.95 0.05 1],100, [0 0 0]); end plot(mu,y(:,1)) fsize=15; %%%%%%%%%5 function [yo] = memo(r, c, k) % temp = 0; for j=1:k-1    temp = temp + c(j)*r(k-j); end yo = temp; %%%%%%%%%%% I get the error ??? One or more output arguments not assigned during call to 'C:\MATLAB7\toolbox\mutools\commands\mu.m (mu)'. 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! What went wrong please? Thanks for any explanation.
 Subject: One or more output arguments not assigned during call From: someone Date: 12 Aug, 2013 14:12:14 Message: 2 of 12 "Sanaa" wrote in message ... > 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); > lambda=parameters(1); b=parameters(2); gama=parameters(3); omega=parameters(4); > % binomial coefficients calculation: > cp1=1; cp2=1; cp3=1; > for j=1:n > c1(j)=(1-(1+q1)/j)*cp1; > c2(j)=(1-(1+q2)/j)*cp2; > c3(j)=(1-(1+q3)/j)*cp3; > cp1=c1(j); cp2=c2(j); cp3=c3(j); > end > % initial conditions setting: > x(1)=Y0(1); y(1)=Y0(2); z(1)=Y0(3); > % calculation of phase portraits /numerical solution/: > for i=2:n > x(i)=y(i-1)*h^q1 - memo(x, c1, i); > y(i)=z(i-1)*h^q2 - memo(y, c2, i); > z(i)=(-mu*y(i-1)-lambda*x(i-1)-b*x(i-1)^3+gama*sin(omega))*h^q3 - memo(z, c3, i); > end > for j=1:n > Y(j,1)=x(j); Y(j,2)=y(j); Y(j,3)=z(j); > end > T=0:h:TSim; > %%%%%%%%% > close all; clear all; > for mu=0:0.001:4 > [t, y]=FODuffing([-1 1 0.6 1],[0.95 0.05 1],100, [0 0 0]); > end > plot(mu,y(:,1)) > fsize=15; > %%%%%%%%%5 > function [yo] = memo(r, c, k) > % > temp = 0; > for j=1:k-1 > temp = temp + c(j)*r(k-j); > end > yo = temp; > %%%%%%%%%%% > I get the error > ??? One or more output arguments not assigned during call to 'C:\MATLAB7\toolbox\mutools\commands\mu.m (mu)'. > > 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! > What went wrong please? > Thanks for any explanation. First, let me say that I'm not familiar with "\toolbox\mutools\commands\mu.m (mu)" But looking at your code, I believe you somehow need to pass a value for mu into the function FODuffing (otherwise, I don't know what the for loop is doing). Something like: 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 mu=0:0.001:4 % without this, I'm not sure what you are plotting plot(mu,y(:,1)) and then change the function FODuffing to: function [T, Y]=FODuffing(parameters, orders, TSim, Y0, mu) or put the for loop inside the fuction FODuffing.
 Subject: One or more output arguments not assigned during call From: Sanaa Date: 13 Aug, 2013 14:00:14 Message: 3 of 12 "someone" wrote in message ... > "Sanaa" wrote in message ... > > 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); > > lambda=parameters(1); b=parameters(2); gama=parameters(3); omega=parameters(4); > > % binomial coefficients calculation: > > cp1=1; cp2=1; cp3=1; > > for j=1:n > > c1(j)=(1-(1+q1)/j)*cp1; > > c2(j)=(1-(1+q2)/j)*cp2; > > c3(j)=(1-(1+q3)/j)*cp3; > > cp1=c1(j); cp2=c2(j); cp3=c3(j); > > end > > % initial conditions setting: > > x(1)=Y0(1); y(1)=Y0(2); z(1)=Y0(3); > > % calculation of phase portraits /numerical solution/: > > for i=2:n > > x(i)=y(i-1)*h^q1 - memo(x, c1, i); > > y(i)=z(i-1)*h^q2 - memo(y, c2, i); > > z(i)=(-mu*y(i-1)-lambda*x(i-1)-b*x(i-1)^3+gama*sin(omega))*h^q3 - memo(z, c3, i); > > end > > for j=1:n > > Y(j,1)=x(j); Y(j,2)=y(j); Y(j,3)=z(j); > > end > > T=0:h:TSim; > > %%%%%%%%% > > close all; clear all; > > for mu=0:0.001:4 > > [t, y]=FODuffing([-1 1 0.6 1],[0.95 0.05 1],100, [0 0 0]); > > end > > plot(mu,y(:,1)) > > fsize=15; > > %%%%%%%%%5 > > function [yo] = memo(r, c, k) > > % > > temp = 0; > > for j=1:k-1 > > temp = temp + c(j)*r(k-j); > > end > > yo = temp; > > %%%%%%%%%%% > > I get the error > > ??? One or more output arguments not assigned during call to 'C:\MATLAB7\toolbox\mutools\commands\mu.m (mu)'. > > > > 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! > > What went wrong please? > > Thanks for any explanation. > > First, let me say that I'm not familiar with "\toolbox\mutools\commands\mu.m (mu)" > But looking at your code, I believe you somehow need to pass a value for mu into the function FODuffing (otherwise, I don't know what the for loop is doing). > Something like: > > 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 > mu=0:0.001:4 % without this, I'm not sure what you are plotting > plot(mu,y(:,1)) > > and then change the function FODuffing to: > > function [T, Y]=FODuffing(parameters, orders, TSim, Y0, mu) > > or put the for loop inside the fuction FODuffing. Thanks a lot for your explanation and help. I modified the code according to your comments close all; clear all; for mu=0:0.1:3.5 [t, y]=FODuffing([ -1 1 0.6 1],[0.95 0.05 1],50, [0 0 0],3.5); end mu=0:0.1:3.5; % without this, I'm not sure what you are plotting plot(mu,y(:,1)) and in the function file function [T, Y]=FODuffing(parameters, orders, TSim, Y0,mu)  however, I get the error ??? Error using ==> plot Vectors must be the same lengths. Error in ==> system1 at 6 plot(mu,y(:,1)) I checked length(mu) ans =     36 >> length(y(:,1)) ans =         5000 what's wrong please?
 Subject: One or more output arguments not assigned during call From: dpb Date: 13 Aug, 2013 14:30:13 Message: 4 of 12 On 8/13/2013 9:00 AM, Sanaa wrote: ... > ... I modified the code > according to your comments > close all; clear all; > for mu=0:0.1:3.5 > [t, y]=FODuffing([ -1 1 0.6 1],[0.95 0.05 1],50, [0 0 0],3.5); > end > mu=0:0.1:3.5; % without this, I'm not sure what you are plotting > plot(mu,y(:,1)) > > and in the function file > function [T, Y]=FODuffing(parameters, orders, TSim, Y0,mu) > however, I get the error > ??? Error using ==> plot > Vectors must be the same lengths. > > Error in ==> system1 at 6 > plot(mu,y(:,1)) > I checked > length(mu) > > ans = > > 36 > >>> length(y(:,1)) > > ans = > > 5000 > what's wrong please? Whatever it is that FODuffing() does, it returned 5000 an array of length 5000 while you set mu to be one of 36. Your mission, should you choose to accept it, is to set the debugger to break in the function and determine how to use it to get the length of vector you need/want to go with mu. There's a good possibility that typing help FODuffing at the command line may go a long ways in that regard, but not assured depending on what the author or the function put in the comment section. IOW, "we can't tell" 'cuz don't have the necessary info other than that you've got to have the same number of points in the X,Y vectors/arrays to plot them. --
 Subject: One or more output arguments not assigned during call From: Steven_Lord Date: 13 Aug, 2013 18:19:42 Message: 5 of 12 "Sanaa " 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
 Subject: One or more output arguments not assigned during call From: Sanaa Date: 14 Aug, 2013 19:39:21 Message: 6 of 12 "Steven_Lord" wrote in message ... > > > "Sanaa " 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.
 Subject: One or more output arguments not assigned during call From: Sanaa Date: 16 Aug, 2013 19:04:07 Message: 7 of 12 Thanks a lot for your explanation. I have corrected many parts of my code and now I have 7 m files. so I am not sending them all. Howerver, running my code : function output=bifurcation(parameters, orders, trans,tend,tstep, Y0,range); D=[]; % data (bifurcation diagram) q1=orders(1); q2=orders(2); q3=orders(3); mu=parameters(1); lambda=parameters(2); b=parameters(3); gama=parameters(4); omega=parameters(5); for mu=range(1):range(2):range(3)     fprintf('mu=%g...\n',mu);     [t,x] = run(parameters, orders, trans,tend,tstep,Y0,mu);          for i=2:length(x(:,2))-1         if((x(i,2)>x(i-1,2))&&(x(i,2)>x(i+1,2)))             D=[D; mu x(i,2)];         end     end      end figure(3) plot(D(:,1),D(:,2),'b.','MarkerSize',1.5) xlabel('\mu','fontsize',18); ylabel('max(X)','fontsize',18); with output=bifurcation([ 0.9 -1 1 0.6 1],[0.85 0.15 1], 100,500,0.05, [0 0 0],[0 0.05 3]); gives the error ??? Attempted to access orders(1); index out of bounds because numel(orders)=0. Error in ==> FODuffing at 6 q1=orders(1); q2=orders(2); q3=orders(3); Error in ==> run at 14     [T, Y]=FODuffing(@dxdt,ttrans,Y0,option,mu) Error in ==> bifurcation at 19     [t,x] = run(parameters, orders, trans,tend,tstep,Y0,mu); Why this error? I have defined the 3 orders in all files!!!! Thanks a lot for your help.
 Subject: One or more output arguments not assigned during call From: someone Date: 16 Aug, 2013 21:25:08 Message: 8 of 12 "Sanaa" wrote in message ... > Thanks a lot for your explanation. I have corrected many parts of my code and now I have 7 m files. so I am not sending them all. Howerver, running my code : > function output=bifurcation(parameters, orders, trans,tend,tstep, Y0,range); > > D=[]; % data (bifurcation diagram) > > q1=orders(1); q2=orders(2); q3=orders(3); > > mu=parameters(1); > lambda=parameters(2); b=parameters(3); gama=parameters(4); omega=parameters(5); > for mu=range(1):range(2):range(3) > > fprintf('mu=%g...\n',mu); > > [t,x] = run(parameters, orders, trans,tend,tstep,Y0,mu); > > for i=2:length(x(:,2))-1 > if((x(i,2)>x(i-1,2))&&(x(i,2)>x(i+1,2))) > D=[D; mu x(i,2)]; > end > end > > end > > figure(3) > plot(D(:,1),D(:,2),'b.','MarkerSize',1.5) > > xlabel('\mu','fontsize',18); > ylabel('max(X)','fontsize',18); > > with > output=bifurcation([ 0.9 -1 1 0.6 1],[0.85 0.15 1], 100,500,0.05, [0 0 0],[0 0.05 3]); > gives the error > ??? Attempted to access orders(1); index out of bounds because numel(orders)=0. > > Error in ==> FODuffing at 6 > q1=orders(1); q2=orders(2); q3=orders(3); > > Error in ==> run at 14 > [T, Y]=FODuffing(@dxdt,ttrans,Y0,option,mu) > > Error in ==> bifurcation at 19 > [t,x] = run(parameters, orders, trans,tend,tstep,Y0,mu); > > > Why this error? I have defined the 3 orders in all files!!!! > Thanks a lot for your help. It looks like the error message is complaining on how you call FODuffing (at line 6), not on how you are calling bifurcation. If FoDuffing is defined as: [T, Y]=FODuffing(@dxdt,ttrans,Y0,option,mu) then how are you passing orders to it?
 Subject: One or more output arguments not assigned during call From: Sanaa Date: 22 Aug, 2013 13:43:11 Message: 9 of 12 Thanks a lot for your kind reply. To make the code clear, I have corrected all my files function [T, Y]=FODuffing(parameters, orders, TSim, Y0,mu) 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=0.9; lambda=parameters(1); b=parameters(2); gama=parameters(3); omega=parameters(4); % binomial coefficients calculation: cp1=1; cp2=1; cp3=1; for j=1:n c1(j)=(1-(1+q1)/j)*cp1; c2(j)=(1-(1+q2)/j)*cp2; c3(j)=(1-(1+q3)/j)*cp3; cp1=c1(j); cp2=c2(j); cp3=c3(j); end % initial conditions setting: x(1)=Y0(1); y(1)=Y0(2); z(1)=Y0(3); % calculation of phase portraits /numerical solution/: for i=2:n x(i)=y(i-1)*h^q1 - memo(x, c1, i); y(i)=z(i-1)*h^q2 - memo(y, c2, i); z(i)=(-mu*y(i-1)-lambda*x(i-1)-b*x(i-1)^3+gama*sin(omega))*h^q3 - memo(z, c3, i); end for j=1:n Y(j,1)=x(j); Y(j,2)=y(j); Y(j,3)=z(j); end T=0:h:TSim; %%%%%%%%%%%%% function [yo] = memo(r, c, k) % temp = 0; for j=1:k-1    temp = temp + c(j)*r(k-j); end yo = temp; %%%%%%%% and I call them in: for mu=0:0.01:6 [t, y]=FODuffing([-1 1 0.6 1],[0.85 0.15 1],50, [0 0 0],mu); D=[]; for i=2:length(y(:,2))-1         if((y(i,2)>y(i-1,2))&&(y(i,2)>y(i+1,2)))             D=[D; mu y(i,2)];         end end end Now there is no error comes out, however, there is no plot appears at all!!!! Could you please explain that to me? Thanks a lot in advance.
 Subject: One or more output arguments not assigned during call From: someone Date: 22 Aug, 2013 18:14:23 Message: 10 of 12 "Sanaa" wrote in message ... > Thanks a lot for your kind reply. To make the code clear, I have corrected all my files > function [T, Y]=FODuffing(parameters, orders, TSim, Y0,mu) > 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=0.9; > lambda=parameters(1); b=parameters(2); gama=parameters(3); omega=parameters(4); > % binomial coefficients calculation: > cp1=1; cp2=1; cp3=1; > for j=1:n > c1(j)=(1-(1+q1)/j)*cp1; > c2(j)=(1-(1+q2)/j)*cp2; > c3(j)=(1-(1+q3)/j)*cp3; > cp1=c1(j); cp2=c2(j); cp3=c3(j); > end > % initial conditions setting: > x(1)=Y0(1); y(1)=Y0(2); z(1)=Y0(3); > % calculation of phase portraits /numerical solution/: > for i=2:n > x(i)=y(i-1)*h^q1 - memo(x, c1, i); > y(i)=z(i-1)*h^q2 - memo(y, c2, i); > z(i)=(-mu*y(i-1)-lambda*x(i-1)-b*x(i-1)^3+gama*sin(omega))*h^q3 - memo(z, c3, i); > end > for j=1:n > Y(j,1)=x(j); Y(j,2)=y(j); Y(j,3)=z(j); > end > T=0:h:TSim; > %%%%%%%%%%%%% > function [yo] = memo(r, c, k) > % > temp = 0; > for j=1:k-1 > temp = temp + c(j)*r(k-j); > end > yo = temp; > %%%%%%%% > and I call them in: > for mu=0:0.01:6 > [t, y]=FODuffing([-1 1 0.6 1],[0.85 0.15 1],50, [0 0 0],mu); > D=[]; > for i=2:length(y(:,2))-1 > if((y(i,2)>y(i-1,2))&&(y(i,2)>y(i+1,2))) > D=[D; mu y(i,2)]; > end > end > end > > Now there is no error comes out, however, there is no plot appears at all!!!! > > Could you please explain that to me? Can you show me where your plot statement is? And what you are plotting. > Thanks a lot in advance.
 Subject: One or more output arguments not assigned during call From: Sanaa Date: 22 Aug, 2013 18:54:05 Message: 11 of 12 "someone" wrote in message ... > "Sanaa" wrote in message ... > > Thanks a lot for your kind reply. To make the code clear, I have corrected all my files > > function [T, Y]=FODuffing(parameters, orders, TSim, Y0,mu) > > 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=0.9; > > lambda=parameters(1); b=parameters(2); gama=parameters(3); omega=parameters(4); > > % binomial coefficients calculation: > > cp1=1; cp2=1; cp3=1; > > for j=1:n > > c1(j)=(1-(1+q1)/j)*cp1; > > c2(j)=(1-(1+q2)/j)*cp2; > > c3(j)=(1-(1+q3)/j)*cp3; > > cp1=c1(j); cp2=c2(j); cp3=c3(j); > > end > > % initial conditions setting: > > x(1)=Y0(1); y(1)=Y0(2); z(1)=Y0(3); > > % calculation of phase portraits /numerical solution/: > > for i=2:n > > x(i)=y(i-1)*h^q1 - memo(x, c1, i); > > y(i)=z(i-1)*h^q2 - memo(y, c2, i); > > z(i)=(-mu*y(i-1)-lambda*x(i-1)-b*x(i-1)^3+gama*sin(omega))*h^q3 - memo(z, c3, i); > > end > > for j=1:n > > Y(j,1)=x(j); Y(j,2)=y(j); Y(j,3)=z(j); > > end > > T=0:h:TSim; > > %%%%%%%%%%%%% > > function [yo] = memo(r, c, k) > > % > > temp = 0; > > for j=1:k-1 > > temp = temp + c(j)*r(k-j); > > end > > yo = temp; > > %%%%%%%% > > and I call them in: > > for mu=0:0.01:6 > > [t, y]=FODuffing([-1 1 0.6 1],[0.85 0.15 1],50, [0 0 0],mu); > > D=[]; > > for i=2:length(y(:,2))-1 > > if((y(i,2)>y(i-1,2))&&(y(i,2)>y(i+1,2))) > > D=[D; mu y(i,2)]; > > end > > end > > end > > > > Now there is no error comes out, however, there is no plot appears at all!!!! > > > > Could you please explain that to me? > > Can you show me where your plot statement is? > And what you are plotting. > > > Thanks a lot in advance. I am sorry for that Directly after the last end plot(D(:,1),D(:,2),'b.','MarkerSize',2.5) I got a point in the middle of the window! I have looped over mu, so why did I get only one point? Thanks a lot for your kind help
 Subject: One or more output arguments not assigned during call From: Steven_Lord Date: 22 Aug, 2013 19:34:37 Message: 12 of 12 "Sanaa " wrote in message news:kv5mod$h6$1@newscl01ah.mathworks.com... > "someone" wrote in message ... >> "Sanaa" wrote in message ... *snip* >> > and I call them in: >> > for mu=0:0.01:6 >> > [t, y]=FODuffing([-1 1 0.6 1],[0.85 0.15 1],50, [0 0 0],mu); >> > D=[]; Each time you use a new value for mu, the previous line destroys any previous contents in the D variable. >> > for i=2:length(y(:,2))-1 >> > if((y(i,2)>y(i-1,2))&&(y(i,2)>y(i+1,2))) >> > D=[D; mu y(i,2)]; >> > end >> > end >> > end >> > >> > Now there is no error comes out, however, there is no plot appears at >> > all!!!! >> > >> > Could you please explain that to me? >> >> Can you show me where your plot statement is? >> And what you are plotting. >> >> > Thanks a lot in advance. > > I am sorry for that > Directly after the last end > plot(D(:,1),D(:,2),'b.','MarkerSize',2.5) > I got a point in the middle of the window! > I have looped over mu, so why did I get only one point? See above. Don't reset D to [] inside the FOR loop. -- Steve Lord slord@mathworks.com To contact Technical Support use the Contact Us link on http://www.mathworks.com