matlab用dsolve解常微分方程并画图,
问题描述:
matlab用dsolve解常微分方程并画图,
例如y'=1-y^2,y(0)=0.
答
>> y=dsolve('Dy=1-y^2','y(0)=0')
y =
tanh(t)
>> t=-2*pi:0.1*pi:2*pi;
>> y=tanh(t);
>> plot(t,y)