How to plot the signal having convolution in frequency domain?

3 visualizaciones (últimos 30 días)
I am doing a signal project to perceive the signals undergoing convolution, modulation and demodulation.
The MATLAB script is attached below. The signal of a(t), b(t), c(t), d(t) and e(t) are defined in the script.
The operation of the signal is shown in the figure below, where the signal operation is x(0.4t).
However, I am having issue in plotting the signal of B in frequency domain, B(w). The figure does not plot B(w) like what a(t) and A(w) did.
I have performed manual calculation and understood that b(t) is just shifting to right by 0.02 after having convolution with h(t).
And in frequency domain, time shifting does not affect the amplitude spectrum in frequency domain, which means that B(w) should be similar to A(w). So the script should be identical as well, but B(w) ends up with unknown issue and it could not be plotted.
Script:
%create symbolic functions x, a, b, c, d, e, f_c with independent variable t
syms x(t) a(t) h(t) b(t) c(t) d(t) e f_c(t) f_c1(t) f_c2(t) t tau
%create symbolic functions A, B, C, D, and E with independent variable w
syms A(w) B(w) C(w) D(w) E(w)
x(t) = cos(100*pi*t);
a(t) = x(0.4*t);
h(t) = dirac(t-0.02);
b(t) = int(a(tau)*h(t-tau), 'tau', -inf, inf);
f_c(t) = 10*cos(2500*pi*t);
f_c1(t) = f_c(t);
f_c2(t) = f_c(t);
c(t) = b(t)*f_c1(t);
d(t) = c(t)*f_c2(t);
figure
subplot (2,1,1)
fplot(a(t))
xlim([-0.05 0.05]),ylim([-1.5 1.5])
title ('Time domain of signal a(t)')
xlabel('Time, t')
ylabel('Amplitude, a(t)')
grid on
A(w) = fourier(a(t), w);
w = -45*pi:0.1*pi:45*pi;
subsA = A(w);
% Replace Inf value with suitable value
idx = subsA == Inf;
subsA(idx) = pi; % choose suitable value from the expression of fourier transform.
subplot (2,1,2)
plot(w,real(subsA));
ylim([0 3.5])
title ('Time domain of signal A(\omega)')
ylabel("\Re(A(\omega))");
xlabel("\omega");
xticks(-40*pi:20*pi:40*pi);
xticklabels({'-40\pi', '-20\pi', '0', '20\pi', '40\pi'})
figure
subplot(2,1,1)
fplot(b(t))
xlim([-0.05 0.05]),ylim([-1.5 1.5])
title ('Time domain of signal b(t)')
xlabel('Time, t')
ylabel('Amplitude, b(t)')
grid on
B(w) = fourier(b(t), w);
simplify(B(w))
w = -45*pi:0.1*pi:45*pi;
subsB = B(w);
% Replace Inf value with suitable value
idx = subsB == Inf;
subsB(idx) = pi; % choose suitable value from the expression of fourier transform.
subplot (2,1,2)
plot(w,real(subsB));
ylim([0 3.5])
title ('Time domain of signal B(\omega)')
ylabel("\Re(B(\omega))");
xlabel("\omega");
xticks(-40*pi:20*pi:40*pi);
xticklabels({'-40\pi', '-20\pi', '0', '20\pi', '40\pi'})
How should I correct my script so that I can produce B(w) graph like what I did for the A(w) signal? Thanks.

Respuesta aceptada

Hiro Yoshino
Hiro Yoshino el 27 de Dic. de 2022
Editada: Hiro Yoshino el 27 de Dic. de 2022
Look like you are dealing with the equations symbolically - I wonder if this is what you really want to do.. anyway.
Note this is the way to manupulate things with explicit equations so all the variables, equations and functions should be given symbollically. In this sense what you missed was the definition of "w" just before passing it to fourier(b(t), w). So you should re-define a symbolic w since you converted it as a normal MATLAB variable before:
syms w;
B(w) = fourier(b(t), w);
simplify(B(w))
....
This allows you to run through the script. Good luck.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by