In: Advanced Math
clc;
clear all;
%y'=-ty/sqrt(2-y^2), y(0)=1, t in [0,5]
f=@(t,y)-t.*y./(sqrt(2-y.^2));
tspan=[0,5];
y0=1;
[t,y1] = ode45(f , tspan, y0);
[t,y1]
%%%%%Solution
ans =
0 1.0000
0.1250 0.9922
0.2500 0.9697
0.3750 0.9342
0.5000 0.8881
0.6250 0.8341
0.7500 0.7747
0.8750 0.7120
1.0000 0.6478
1.1250 0.5836
1.2500 0.5208
1.3750 0.4602
1.5000 0.4027
1.6250 0.3489
1.7500 0.2994
1.8750 0.2543
2.0000 0.2137
2.1250 0.1778
2.2500 0.1463
2.3750 0.1192
2.5000 0.0961
2.6250 0.0765
2.7500 0.0603
2.8750 0.0470
3.0000 0.0363
3.1048 0.0290
3.2096 0.0229
3.3145 0.0180
3.4193 0.0140
3.5077 0.0113
3.5960 0.0090
3.6844 0.0072
3.7728 0.0057
3.8513 0.0046
3.9297 0.0037
4.0082 0.0030
4.0867 0.0024
4.1582 0.0019
4.2298 0.0016
4.3014 0.0013
4.3730 0.0010
4.4393 0.0008
4.5057 0.0007
4.5721 0.0005
4.6384 0.0004
4.7006 0.0004
4.7628 0.0003
4.8250 0.0002
4.8872 0.0002
4.9154 0.0002
4.9436 0.0002
4.9718 0.0001
5.0000 0.0001