Question: I need to modify the matlab code below so that it becomes a function which iterates the Ricker model ( the equation for this is
I need to modify the matlab code below so that it becomes a function which iterates the Ricker model ( the equation for this is RM= (a*x.*exp(-x)) and its in the code below) a total of 600 times for a particular value ofa. The arguments of the function should be the parameter a and the initial condition x0 and this program should return the values in the form of a list.
% defining a recursive function in an m-file function y=plot_traj(a) RM=inline('a*x.*exp(-x),'a,'x) % Note that we are using an inline function. Sometimes its easier to do this. % Collecting list of x-coordinates for i = 1:31, X(i)=i-1 end % Collecting list of y-coordinates for i = 1:30, Y(i+1)=RM(a,iter(i)) iter(i+1)=Y(i+1) end y = plot(X,Y,'*)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
