作业帮 > 数学 > 作业

用MATLAB的向量表示法描述f(t)=cos(πt/2)[u(t)-u(t-4)]

来源:学生作业帮 编辑:作业帮 分类:数学作业 时间:2024/05/12 16:28:03
用MATLAB的向量表示法描述f(t)=cos(πt/2)[u(t)-u(t-4)]
 t=-2:0.01:8;
f1=[zeros(1,2),ones(1,5),zeros(1,4)];
f=cos(pi*t/2).*f1;
plot(t,f)
axis([-2,8,-2,2])
?Error using ==> times
Matrix dimensions must agree.
怎么改能得到以下图形?一定要用向量表示法.
t=-2:0.01:8;
f1=[zeros(1,length(-2:0.01:0)),ones(1,length(0.01:0.01:4)),zeros(1,length(4.01:0.01:8))];
f=cos(pi*t/2).*f1;
plot(t,f)
axis([-2,8,-2,2])