MATLAB: How to plot an ODE

odeplotting

Silly question but how can I plot a simple ODE like the following?
My ODE is:
dy/dt=1-(t/n)-y
where n is an array
n=[1 2 3 5 Inf]

Best Answer

Use for loop to solve equation 5 times for each n
n = [1 2 3 5 inf];
f = @(t,y,n) 1-t/n+y;
for i = 1:length(n)
[t,y] = ode45(f,[0 5],ic,[],n(i));
line(t,y)
end