用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/06/28 17:56:45
![用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.怎么改能得到以下图形?一定要](/uploads/image/z/6998511-39-1.jpg?t=%E7%94%A8MATLAB%E7%9A%84%E5%90%91%E9%87%8F%E8%A1%A8%E7%A4%BA%E6%B3%95%E6%8F%8F%E8%BF%B0f%28t%29%3Dcos%28%CF%80t%2F2%29%5Bu%28t%29-u%28t-4%29%5D+t%3D-2%3A0.01%3A8%3Bf1%3D%5Bzeros%281%2C2%29%2Cones%281%2C5%29%2Czeros%281%2C4%29%5D%3Bf%3Dcos%28pi%2At%2F2%29.%2Af1%3Bplot%28t%2Cf%29axis%28%5B-2%2C8%2C-2%2C2%5D%29%3FError+using+%3D%3D%26gt%3B+timesMatrix+dimensions+must+agree.%E6%80%8E%E4%B9%88%E6%94%B9%E8%83%BD%E5%BE%97%E5%88%B0%E4%BB%A5%E4%B8%8B%E5%9B%BE%E5%BD%A2%3F%E4%B8%80%E5%AE%9A%E8%A6%81)
用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]);