1、求微分方程的解析解、并使用MATLAB画出它们的图形 (1)y(4)=y,y(0)=y’(0)=2,y”(0)=y””(0)=1
时间: 2023-07-14 19:11:51 浏览: 195
Matlab基础:实验四 求微分方程的解.doc
这是一个四阶常微分方程,可以写成特征方程:
r^4 - 1 = 0
解得:
r = ±1, ±i
因此通解为:
y(t) = c1*e^t + c2*e^(-t) + c3*cos(t) + c4*sin(t)
带入初始条件:
y(0) = c1 + c2 + c3 = 0
y'(0) = c1 - c2 + c4 = 2
y''(0) = c3 + c4 = 1
y'''(0) = -c3 + c4 = 0
解得:
c1 = c2 = c3 = 0, c4 = 1
因此特解为:
y(t) = e^t - e^(-t) + sin(t)
MATLAB代码如下:
syms y(t)
ode = diff(y, t, 4) == y;
cond1 = y(0) == 2;
cond2 = diff(y)(0) == 2;
cond3 = diff(y, t, 2)(0) == 1;
cond4 = diff(y, t, 3)(0) == 1;
conds = [cond1 cond2 cond3 cond4];
ySol(t) = dsolve(ode, conds);
fplot(ySol,[-10,10])
阅读全文