用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 ==> timesMatrix dimensions must agree.怎么改能得到以下图形?一定要
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/15 23:48:27
用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 ==> timesMatrix dimensions must agree.怎么改能得到以下图形?一定要
用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.
怎么改能得到以下图形?一定要用向量表示法.
用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 ==> timesMatrix 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])
你那u(t)是啥表达式?啥叫向量表达法?f1=[zeros(1,2),ones(1,5),zeros(1,4)];这句跟逻辑数组作用是相同的,搞这么麻烦干啥?fi和t的大小不同,导致f=cos(pi*t/2).*f1;这句的乘法没法运行,你这到底要干啥呀?
clear all
t=-2:0.01:8;
f=cos(pi*t/2).*(t>=0&t<=4);
plot(t,f),axis([-2,8,-1.2,1.2]);