You are on page 1of 1

f1.

m
function xp=f1(t,x)
xp=x-2;
end

df1.m

[t,x]=ode23('f1',[0,10],[2]);
plot(t,x,'k')
hold on
[t,x]=ode23('f1',[0,10],[4]);
plot(t,x,'g')
hold on
[t,x]=ode23('f1',[0,10],[1]);
plot(t,x,'b')
hold on
[t,x]=ode23('f1',[0,10],[-1]);
plot(t,x,'r')
hold on
[t,x]=ode23('f1',[0,10],[3]);
plot(t,x,'c')
hold on
hold off

f2.m
function xp=f2(t,x)
xp=x.*x-11/3.*x-4/3;
end

df2.m
[t,x]=ode23('f1',[0,10],[4]);
plot(t,x,'k')
hold on
[t,x]=ode23('f1',[0,10],[-1/3]);
plot(t,x,'g')
hold on
[t,x]=ode23('f1',[0,10],[3]);
plot(t,x,'b')
hold on
[t,x]=ode23('f1',[0,10],[-1/2]);
plot(t,x,'r')
hold on
[t,x]=ode23('f1',[0,10],[3]);
plot(t,x,'c')
hold on
[t,x]=ode23('f1',[0,10],[1]);
plot(t,x,'c')
hold on
hold off

You might also like