How to plot convolution between signal and Hilbert tranform operator

2 views (last 30 days)
Hi... I ask to reproduce the complex signal as a result from convolution between cosine wave and hilbert transform operator as a figure. I do the script as below, but then i confuse how to separate imaginary and real part signal. Can anyone help me?
t=0:0.01:1;
f=2;
omega=2*pi*f;
y=cos(omega*t);
%signal
h=1./(pi*t);
cs=conv(y,h);
% plot data
subplot (3,1,1)
plot (t,y)
subplot (3,1,2)
plot (t,h,'-r')
set(gca, 'XAxisLocation', 'origin', 'YAxisLocation', 'origin')
box off
subplot (3,1,3)
plot (t,cs)

Accepted Answer

Sufiyan
Sufiyan on 27 Apr 2023
Hi,
You can refer to the code below.
t = 0:0.01:1;
f = 2;
omega = 2*pi*f;
y = cos(omega*t);
h = [Inf, 1./(pi*t(2:end))];
cs = conv(y,h);
% Plot
subplot(3,1,1)
plot(t,y)
xlabel('Time')
ylabel('y(t)')
title('Input Signal')
subplot(3,1,2)
plot(t,h,'-r')
xlabel('Time')
ylabel('h(t)')
title('Impulse Response')
subplot(3,1,3)
t_cs = linspace(0,2,length(cs));
plot(t_cs,real(cs),'b')
hold on
plot(t_cs,imag(cs),'r')
xlabel('Time')
ylabel('cs(t)')
title('Real and Imaginary Parts')
legend('Real','Imaginary')
hold off
Hope this helps!

More Answers (0)

Community Treasure Hunt

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

Start Hunting!