早教吧 育儿知识 作业答案 考试题库 百科 知识分享

求一些MATLAB的简易编程答案.1.∫y^2+3/y^3+2y^2+1 (范围上限a,下限b)2.∫e^(-x^2+1) (范围上限0,下限负无穷)3.求线性方程组3x+4y+z=12X+3Y+3Z=15X+6y+3z=34.任意三阶微分方程求解5.f(x)=ax^2+bx+c6.y=sin(2t+3) t范围[0,

题目详情
求一些MATLAB的简易编程答案.
1.∫y^2+3/y^3+2y^2+1 (范围上限a,下限b)
2.∫e^(-x^2+1) (范围上限0,下限负无穷)
3.求线性方程组
3x+4y+z=1
2X+3Y+3Z=1
5X+6y+3z=3
4.任意三阶微分方程求解
5.f(x)=ax^2+bx+c
6.y=sin(2t+3) t范围[0,40] 用红色曲线显示
要能运行哈!
▼优质解答
答案和解析
1、syms y a b; %定义符号变量
F=int(y^2+3/y^3+2*y^2+1,y,b,a) %对y积分,下限b,上限a
F = piecewise([a < 0 or 0 < b, (a^5 + a^3 - 3/2)/a^2 - (b^5 + b^3 - 3/2)/b^2], [Otherwise, int(3*y^2 + 3/y^3 + 1, y = b..a)]) %积分结果
2、syms x ; %定义符号变量
F=int(exp(-x^2+1),x,-inf,0) %上限0,下限-inf
F =(pi^(1/2)*exp(1))/2 %结果
3、 A=[3 4 1;2 3 3;5 6 3]; %方程组系数矩阵
b=[1;1;3];%常系数矩阵
x=A\b %求解
x =
2.0000
-1.3333
0.3333 %结果
4、任意三阶微分方程表示为:a*y'''+b*y''+c*y'+d*y=e;
matlab代码: syms a b c d e x; %定义符号变量
y=dsolve('a*D3y+b*D2y+c*Dy+d*y=e','x')% dsolve 微分方程求解命令
y =
C2/exp(x*((c/(3*a) - b^2/(9*a^2))/(((d/(2*a) + b^3/(27*a^3) - (b*c)/(6*a^2))^2 + (c/(3*a) - b^2/(9*a^2))^3)^(1/2) - b^3/(27*a^3) - d/(2*a) + (b*c)/(6*a^2))^(1/3) + b/(3*a) - (((1/2/a*d + 1/27/a^3*b^3 - 1/6/a^2*b*c)^2 + (1/3/a*c - 1/9/a^2*b^2)^3)^(1/2) - 1/27/a^3*b^3 - 1/2/a*d + 1/6/a^2*b*c)^(1/3))) + C3*exp(x*((c/(3*a) - b^2/(9*a^2))/(2*(((d/(2*a) + b^3/(27*a^3) - (b*c)/(6*a^2))^2 + (c/(3*a) - b^2/(9*a^2))^3)^(1/2) - b^3/(27*a^3) - d/(2*a) + (b*c)/(6*a^2))^(1/3)) - b/(3*a) - (((d/(2*a) + b^3/(27*a^3) - (b*c)/(6*a^2))^2 + (c/(3*a) - b^2/(9*a^2))^3)^(1/2) - b^3/(27*a^3) - d/(2*a) + (b*c)/(6*a^2))^(1/3)/2 + (3^(1/2)*((c/(3*a) - b^2/(9*a^2))/(((d/(2*a) + b^3/(27*a^3) - (b*c)/(6*a^2))^2 + (c/(3*a) - b^2/(9*a^2))^3)^(1/2) - b^3/(27*a^3) - d/(2*a) + (b*c)/(6*a^2))^(1/3) + (((d/(2*a) + b^3/(27*a^3) - (b*c)/(6*a^2))^2 + (c/(3*a) - b^2/(9*a^2))^3)^(1/2) - b^3/(27*a^3) - d/(2*a) + (b*c)/(6*a^2))^(1/3))*i)/2)) + C4/exp(x*(b/(3*a) - (c/(3*a) - b^2/(9*a^2))/(2*(((d/(2*a) + b^3/(27*a^3) - (b*c)/(6*a^2))^2 + (c/(3*a) - b^2/(9*a^2))^3)^(1/2) - b^3/(27*a^3) - d/(2*a) + (b*c)/(6*a^2))^(1/3)) + (((d/(2*a) + b^3/(27*a^3) - (b*c)/(6*a^2))^2 + (c/(3*a) - b^2/(9*a^2))^3)^(1/2) - b^3/(27*a^3) - d/(2*a) + (b*c)/(6*a^2))^(1/3)/2 + (3^(1/2)*((c/(3*a) - b^2/(9*a^2))/(((d/(2*a) + b^3/(27*a^3) - (b*c)/(6*a^2))^2 + (c/(3*a) - b^2/(9*a^2))^3)^(1/2) - b^3/(27*a^3) - d/(2*a) + (b*c)/(6*a^2))^(1/3) + (((d/(2*a) + b^3/(27*a^3) - (b*c)/(6*a^2))^2 + (c/(3*a) - b^2/(9*a^2))^3)^(1/2) - b^3/(27*a^3) - d/(2*a) + (b*c)/(6*a^2))^(1/3))*i)/2)) + e/d
%结果由于a,b,c,d,e等都是符号,没有具体值,且微分方程的初始值也没有,故结果比较复杂
5、syms a b c x; %此题不知你想求什么
f=a*x^2+b*x+c
f =a*x^2 + b*x + c
6、t=0:0.05:40; %t为自变量,从0到40,每步增量0.05
y=sin(2*t+3); %y的表达式
plot(t,y,'r') %plot绘图函数,'r'表示线条颜色为红色