1
votes

This would be it : y'(t)=y(t)/t-t^2/y^2*t y(1)=1

i have tried: function hazi3b()

[T,Y] = ode45( @bfugveny, [1 12], 1); plot(T, Y, 'gx')

end

and:

function dy=bfugveny(t,y)

dy = y(t)/t - t^2/(y^2*t);

end

1
Attempted to access y(1.22); index must be a positive integer or logical. Error in bfugveny (line 3) dy = y(t)/t - t^2/(y^2*t); Error in ode45 (line 262) f(:,2) = feval(odeFcn,t+hA(1),y+f*hB(:,1),odeArgs{:}); Error in hazi3b (line 2) [T,Y] = ode45( @bfugveny, [1 12], 1); - Iszlai Lehel

1 Answers

2
votes

You don't need to write y(t) in your formula.

The y passed into your oracle is already a guess for y-evaluated-at-time-t.

So try

dy = y/t - t^2/(y^2*t);