Hello everyone. Here is the code that gives me the following error:
In an assignment A(I) = B, the number of elements in B and I must be the same.Error in SeasonalityLVEbif>Preypred (line 33)Ydot(1) =(alpha1*(Ke-Y(1)))+Ke*pi*Y(2)/6;
The code :
function SeasonalityLVEbifrect=[200 80 700 650];%fix the window size and position
set(0,'defaultfigureposition',rect);global alpha1 b P theta q c a e dalpha1=0.5; b=1.2; P=0.025; theta= 0.03;q=0.0038; c= 0.81; a= 0.25; e=0.8; d=0.25; option=odeset('AbsTol',1e-11,'RelTol',1e-11);inc=[0.01:1:220]';time=[ inc ] ;limit=[200:1:220];ymin=[];ymax=[];for Ke=0.01:0.05:2,IC=[1.5 1 0 0.5 0.25 ];[t,U]=ode45(@Preypred,time,IC);u1=U(limit,1);ymin=[ymin,min(u1)];ymax=[ymax,max(u1)];endX=0.01:0.05:2;figureplot(X, ymin,'g.',X, ymax,'k.');legend('grazer min','grazer max'),hold onxlim([0.01 2]);title('Bifurcation diagram for LVE model','FontSize',12)xlabel('Ke, the equilibrium carrying capacity');ylabel('grazer','Rotation',90);function [Ydot] = Preypred(t,Y)global alpha1 Ke b P theta q c a e dYdot(1) =(alpha1*(Ke-Y(1)))+Ke*pi*Y(2)/6;Ydot(2) =Y(2)*(1-Y(2)^2-Y(3)^2)-2*pi*Y(3)/6;Ydot(3) = Y(3)*(1-Y(2)^2-Y(3)^2)+2*pi*Y(2)/6;Ydot(4) = b*Y(4)*(1-Y(4)/(min(Y(1),(P-theta*Y(5))/q)))-c*Y(4)*Y(5)/(a+Y(4));Ydot(5) = e*min(1,((P-theta*Y(5))/Y(4))/theta)*c*Y(4)*Y(5)/(a+Y(4))-d*Y(5);Ydot=Ydot';
Could you please help me to fix it?
Best Answer