有关matlab中conv的使用 大家帮看看是哪里错了
mip版 关注:134 答案:2 悬赏:0
解决时间 2021-02-24 09:25
已解决
2021-02-23 19:18
t=[-2:0.01:2]; %Generate sampling time.
e=(t>-1&t<1); %Define a square wave with width of 2.
h=(t>-0.5&t<0.5);
%Define a square wave with width of 1.
[r1,t1]=cconv1(e,t,h,t);
%Call ‘cconv1’ to finish convolution integral.
subplot(3,1,1);plot(t,e);axis([-2 2 -0.2 1.2]);title('e(t)');
subplot(3,1,2);plot(t,h);axis([-2 2 -0.2 1.2]);title('h(t)');
subplot(3,1,3);plot(t1,r1);axis([-4 4 -0.2 1.2]);title('r(t)');
Undefined function 'conv2' for input arguments of type 'char'.
Error in conv (line 39)
c = conv2(a(:),b(:),shape);
Error in cconv1 (line 6)
w=T*conv(u,v); %Calculate (6) via function ‘conv’.
function[w,tw]=cconv1(u,tu,v,tv)
% u and v are two vectors to be convoluted, and tu and tvare their sampling times respectively.
%w is the convolution result and tw is w’s sampling time.
T=tu(2)-tu(1); %Get sample interval.
w=T*conv(u,v); %Calculate (6) via function ‘conv’.
tw=tu(1)+tv(1)+T*[0:length(u)+length(v)-2]';
%Distribute sample time for w.
最佳答案
2021-02-23 20:53
一个conv 只能用于两者两者之间的运算,不能三者或以上。如果有多个,则要用多个conv。
全部回答
1楼
2021-02-23 22:26
你想实现什么功能?就目前信息来看,conv的内容必须是数字不是逻辑符号,ra和rb是logical类型。
我要举报
如果感觉以上信息为低俗/不良/侵权的信息,可以点下面链接进行举报,我们会做出相应处理,感谢你的支持!
点此我要举报以上信息!
推荐资讯
大家都在看