作业帮 > 综合 > 作业

Matlab Plot显示图像

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/21 17:26:41
Matlab Plot显示图像
我要显示出Xh从0到20S的图像,其中A B求出后是两个向量,(7)(8)步输出没错.可是我要把A B带入Xh,然后显示出0到20的图像,应该是三条曲线,却一直出现错误,请问大侠该怎么写(8)步以后的程序?
syms A B x y Xh t
x=[0 1 -0.5];
y=[1 0 0];
A=x;
B=4*y/sqrt(15)+x/sqrt(15);
A (7)
B (8)
Xh=exp(-0.25*t)*(A*cos(0.968*t)+B*sin(0.968*t));
t=linspace(0,20);
Xh=double(subs(A,B,t));
plot(t,h);
x=[0 1 -0.5];
y=[1 0 0];
A=x;
B=4*y/sqrt(15)+x/sqrt(15);
c=['r' 'b' 'y'];
for m=1:3
t=linspace(0,20);
Xh=exp(-0.25*t).*(A(m).*cos(0.968*t)+B(m).*sin(0.968*t));
%Xh=double(subs(A,B,t));
plot(t,Xh,c(m));
hold on
end
legend('第1次图','第2次图','第3次图' )

按上面语句试试