I have two second order differential equations. I solved them with Ode45, but I want to subtract the two resulting answers from each other and plot the subtraction of the one answer from another one. How can I do that???
function dy=function1(t,y)dy=zeros(2,1);dy(1)=y(2);dy(2)=sin(t)-y(1);endfunction dy=function2(t,y)dy=zeros(2,1);dy(1)=y(2);dy(2)=(t^2)-2*y(1)-y(2);end[T,Y]=ode45(@function1,[0 10],[0 0]);[M,X]=ode45(@function2,[0 10],[0 0]);plot(T,Y(:,1),M,X(:,1))
I want to plot X(:,1)-Y(:,1)???
Best Answer