Error using conv2 First and second arguments must be single or double
Show older comments
I'm running the script below to prove the identity property of linear convolution ( x1(n)*d(n-n0)= x1(n-n0) )
However when I run the script I get the following errors
"Error using conv2 First and second arguments must be single or double.
Error in conv (line 38) c = conv2(a(:),b(:),shape);
Error in conv_m (line 10) ny = nyb:nye; y = conv(x,h);"
I think this has something to do with the matrix generated by the impseq function being "logical" instead of "double."
Any suggestions?
%Identity %x1(n)*d(n-n0)= x1(n-n0)
nx=[-50:50]; x1=cos(pi*nx/4).*(stepseq(-5,-50,50)- stepseq(20,-50,50));
%x1(n)*delta(n-n0)
[y4,m4]=impseq(5,-50,50);
[y5,m5]=conv_m(x1,nx,y4,m4);
subplot(2,2,3);stem(m5,y5,'k');title('x1*delta(nn0)'); xlabel('m');
[y1,m1]=sigshift(x1,nx,10);
subplot(2,2,4);stem(m4,y4,'k');title('x1(nn0)]');xlabel('m');
axis([-40 60 -10 20]);
Accepted Answer
More Answers (0)
Categories
Find more on Linear Prediction in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!