matlab中怎么求解微分方程的精确解
展开全部
对于相对简单的微分方程或微分方程组,可以dsolve()函数得到解析值(精确解)。
例①:
>>syms x(t) a
>>dsolve(diff(x) == -a*x)
ans =
C2*exp(-a*t)
>>dsolve(diff(x) == -a*x, x(0) == 1)
ans =
exp(-a*t)
例②:
syms y(t) a
>> Dy = diff(y); D2y = diff(y,2);
>> y=dsolve(D2y == -a^2*y, y(0) == 1, Dy(pi/a) == 0)
y =
exp(-a*t*i)/2 + exp(a*t*i)/2
例③:
>> syms w(t)
>> Dw = diff(w); D2w = diff(w,2);
>> w = dsolve(diff(D2w) == -w, w(0)==1, Dw(0)==0, D2w(0)==0)
w =
exp(-t)/3 + (2*exp(t/2)*cos((3^(1/2)*t)/2))/3
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询