function Lab5 clear all; close all; clc; function dy=myODE(t,y) dy1=y(2); %y_1' = y_2 dy2=-sin(y(1)); dy=[dy1;dy2]; end % initial conditions y(0)=y0_1 and y'(0)=y0_2 y0=[-1; 2]; % time interval t=0:0.1:5; % Solving the ODE for different values of the parameters %%%% Try different values for k and m to answer the questions in your lab [t,y1]=ode45(@myODE, t, y0); figure % a positive and a negative evalues [x,y]=meshgrid(-7:.2:7,-5:.2:5); dx= y; dy= -sin(x); dyu=0.5*dy./sqrt(dy.^2+dx.^2); dxu=0.5*dx./sqrt(dy.^2+dx.^2); quiver(x,y,dxu,dyu) hold on plot(y1(:,1),y1(:,2), 'LineWidth',2) xlabel('x') ylabel('y') %%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Uncomment when solving the Food Chain Problem % % Matrix % A=[[1,2,3];[5,6,7];[0,1,0]] % % Finds eigenvalues and eigenvectors of A % [V,D]=eig(A) end