How to remove sidelobes using fdatool

9 views (last 30 days)
VIJETH J SHETTY
VIJETH J SHETTY on 28 Feb 2024
Commented: Mathieu NOE on 6 Mar 2024
I have generated an 802.11a frame using my VHDL simulation. When I analyze it in the frequency domain(cap data through iio oscilloscope), I observe sidelobes. I attempted to address this by adjusting parameters in the RF configuration, but to no avail. Now, I'm trying to remove these sidelobes using MATLAB's 'fdatool'. As I'm new to this tool, I designed a basic filter and saved its coefficients, but the resulting spectrum still appears distorted. Could you guide me on where I might be going wrong, and how I can correct this?
sampling fq=20Mhz
Filter Design
Atteched my files
matlab code :
clc;
clear;
close;
data=readmatrix("DATA1.csv"); % VHDL genarated data IQ
load('num_coef100.mat'); % fdatool genarated coefficients
LPF=(coef_100.');
real1=data(:,1);
imag1=data(:,2);
IQ_DATA= real1 + 1i*imag1 ;
iq_data = IQ_DATA;
filter_coefficients = LPF;
% Apply the filter to your IQ data
filtered_data = filter(filter_coefficients, 1, iq_data); % FIR
% Compute the FFT of the original IQ data
N = length(iq_data);
fft_original = fftshift(fft(iq_data));
fft_freq_original = (-N/2:N/2-1)*(1/N);
% Compute the FFT of the filtered data
fft_filtered = fftshift(fft(filtered_data));
fft_freq_filtered = (-N/2:N/2-1)*(1/N);
figure;
subplot(2,1,1);
plot(fft_freq_original, abs(fft_original), 'b');
xlabel('Frequency (Hz)');
ylabel('Magnitude');
title('Frequency Spectrum Before Applying Filter');
subplot(2,1,2);
plot(fft_freq_filtered, abs(fft_filtered), 'r');
xlabel('Frequency (Hz)');
ylabel('Magnitude');
title('Frequency Spectrum After Applying Filter');

Answers (1)

Mathieu NOE
Mathieu NOE on 28 Feb 2024
hello
i prefer to use an elliptic filter as it has a steep roll off after the cut of frequency (fc)
here's the filter alone
fc = 0.25; % cut off freq (normalized to fs/2)
fs = 1;
order = 6; % 6th-order lowpass elliptic filter
ripple_dB = 3; %passband ripple
sa = 30; % stopband attenuation,
[b,a] = ellip(order,ripple_dB,sa,fc/(fs/2));
freqz(b,a,[],fs)
subplot(2,1,1)
ylim([-100 20])
and used in your code
clc;
clear;
close;
data=readmatrix("DATA1.csv"); % VHDL genarated data IQ
% load('num_coef100.mat'); % fdatool genarated coefficients
% LPF=(coef_100.');
real1=data(:,1);
imag1=data(:,2);
IQ_DATA= real1 + 1i*imag1 ;
iq_data = IQ_DATA;
% filter_coefficients = LPF;
% Apply the filter to your IQ data
fc = 0.25; % cut off freq (normalized to fs/2)
fs = 1;
order = 6; % 6th-order lowpass elliptic filter
ripple_dB = 3; %passband ripple
sa = 30; % stopband attenuation,
[b,a] = ellip(order,ripple_dB,sa,fc/(fs/2));
filtered_data = filter(b, a, iq_data); % IIR
% Compute the FFT of the original IQ data
N = length(iq_data);
fft_original = fftshift(fft(iq_data));
fft_freq_original = (-N/2:N/2-1)*(1/N);
% Compute the FFT of the filtered data
fft_filtered = fftshift(fft(filtered_data));
fft_freq_filtered = (-N/2:N/2-1)*(1/N);
figure;
subplot(2,1,1);
plot(fft_freq_original, abs(fft_original), 'b');
xlabel('Frequency (Hz)');
ylabel('Magnitude');
title('Frequency Spectrum Before Applying Filter');
subplot(2,1,2);
plot(fft_freq_filtered, abs(fft_filtered), 'r');
xlabel('Frequency (Hz)');
ylabel('Magnitude');
title('Frequency Spectrum After Applying Filter');
  9 Comments
VIJETH J SHETTY
VIJETH J SHETTY on 6 Mar 2024
Thank you for trying to help despite the hardware limitations. I appreciate your efforts.
Mathieu NOE
Mathieu NOE on 6 Mar 2024
Wished I ould do better, but I am aware that I have reached my limits
hope you find a way to solve it

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!