How to plot convolution between signal and Hilbert tranform operator

조회 수: 10 (최근 30일)
nirwana
nirwana 2023년 3월 20일
답변: Sufiyan 2023년 4월 27일
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)

채택된 답변

Sufiyan
Sufiyan 2023년 4월 27일
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!

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by