How to create low pass filter to remove the signal greater than 40pi using FDA/filterDesigner tools on MATLAB?

58 Views Asked by At

I am designing a filter to remove the unwanted signal in my D(w). The intention is to remove the signal at 4960pi and 5040pi (only w=±40pi is needed). So I use the built-in filter designer tool to remove the signal. Due to its shorter transition band, I decided to use Chebyshev (Butterworth is also ok). However, the matlab script has the following error. Nothing was being plotted on the graph too.

[![enter image description here][1]][1] [1]: https://i.stack.imgur.com/c3n7n.png

This is the specification for my Chebyshev filter. enter image description here

Signal D(w) has some noise, only the impulse at 40pi is needed. So LPF will suit in this case, but the output has some issue.

enter image description here

This is my script including the previous noise (introduced during modulation and demodulation processes). Any guidance is much appreciated.

%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) 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 (3,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 = -60*pi:0.1*pi:60*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 (3,1,2)
plot(w,real(subsA));
ylim([0 4])
title ('Frequency 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'})

subplot (3,1,3)
plot(w, angle(A(w)))
title ('Phase spectrum of signal A(\omega)')
ylabel("\angle(A(\omega))");
xlabel("\omega");


figure

subplot(3,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

syms B w
B(w) = fourier(b(t), w);
w = -60*pi:0.1*pi:60*pi;
subsB = B(w);
% Replace Inf value with suitable value
idx = abs(subsB) == Inf;
subsB(idx) = pi; % choose suitable value from the expression of fourier transform.
subplot (3,1,2)
plot(w,real(subsB));
ylim([0 4])
title ('Frequency 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'})

subplot (3,1,3)
plot(w, angle(B(w)))
ylim([-4 4])
title ('Phase spectrum of signal B(\omega)')
ylabel("\angle(B(\omega))");
xlabel("\omega");

figure

subplot(3,1,1)
fplot(c(t))
xlim([-0.05 0.05]),ylim([-12 12])
title ('Time domain of signal c(t)')
xlabel('Time, t')
ylabel('Amplitude, c(t)')
grid on

syms C w
C(w) = fourier(c(t), w);
%simplify(C(w))
w = -2800*pi:20*pi:2800*pi;
subsC = C(w);
subsC
% Replace Inf value with suitable value
idx = abs(subsC) == Inf;
idx
subsC(idx) = pi; % choose suitable value from the expression of fourier transform.
subplot (3,1,2)
plot(w,real(5*subsC));
%testing = subsC
ylim([0 20])
title ('Frequency domain of signal C(\omega)')
ylabel("\Re(C(\omega))");
xlabel("\omega");


subplot (3,1,3)
plot(w, angle(C(w)))
ylim([-4 4])
title ('Phase spectrum of signal C(\omega)')
ylabel("\angle(C(\omega))");
xlabel("\omega");


figure 

subplot(3,1,1)
fplot(d(t))
xlim([-0.1 0.1]),ylim([-110 110])
title ('Time domain of signal d(t)')
xlabel('Time, t')
ylabel('Amplitude, d(t)')
grid on

syms D w
D(w) = fourier(d(t), w);
w = -5050*pi:10*pi:5050*pi;
%simplify(D(w))
subsD = D(w);
%D(w)
% Replace Inf value with suitable value
idx = abs(subsD) == Inf;
subsD(idx) = pi; % choose suitable value from the expression of fourier transform.
subplot (3,1,2)
plot(w,real(25*subsD));
ylim([0 160])
title ('Frequency domain of signal D(\omega)')
ylabel("\Re(D(\omega))");
xlabel("\omega");

subplot (3,1,3)
plot(w, angle(D(w)))
ylim([-4 4])
title ('Phase spectrum of signal D(\omega)')
ylabel("\angle(D(\omega))");
xlabel("\omega");

figure

LPF_fil = lpf;
E = filter(LPF_fil, D);
subplot(3,1,1)
plot(w, E)

% fc = 150000;
% fs = 1000000;
% [e_mag,e_ang] = butter(6,fc/(fs/2));
% freqz(e_mag,e_ang)
% e = filter(e_mag,e_ang,d);
% eF=fftshift(fft(e));
% eFm=abs(eF);
% eFa=angle(eF);
% eFa(abs(eF)<T)=0;
0

There are 0 best solutions below