When i try to calculate the convolution of two functions i get: Warning: Using only the real component of complex data.

14 views (last 30 days)
m3=length(x3);
n3=length(h1);
X3=[x3,zeros(1,n3)];
H3=[h1,zeros(1,m3)];
for i=1:n3+m3-1
Y3(i)=0;
for j3=1:m3
if(i-j3+1>0)
Y3(i)=Y3(i)+X3(j3)*H3(i-j3+1);
else
end
end
end
figure;
subplot(3,1,1); stem(x3, '-b^'); xlabel('n');
ylabel('x[n]'); grid on;
subplot(3,1,2); stem(h1, '-ms');
xlabel('n'); ylabel('h[n]'); grid on;
subplot(3,1,3); stem(Y3, '-ro');
ylabel('Y[n]'); xlabel('n'); grid on;
title('Convolution of Two Signals without conv function')
What can i do to plot the full real and imaginary parts
  6 Comments

Sign in to comment.

Answers (0)

Categories

Find more on Function Creation in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!