Use the MATLAB builtin function ode45 to solve the initial v

Use the MATLAB built-in function ode45 to solve the initial value problem y\' = [cos y]^2 y(0) =0 In the interval [0, 10). Then plot your solution together with the exact solution y(x) = tan^-1 x.

Solution

function f=fun1(y)

f=cos(x).^2

[tv2 f2]=ode45(\'fun1\',[0 10],1);

plot(tv2,f2,\'--\')

title(\'y\'\'=(cos(y))^2, y(0)=0, t in [0, 10]\')

grid

axis([0 10 0 1])

 Use the MATLAB built-in function ode45 to solve the initial value problem y\' = [cos y]^2 y(0) =0 In the interval [0, 10). Then plot your solution together wit

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site