How to effectively remove the DC component from a frequency spectrum analysed using Welch's Method?
7 views (last 30 days)
Show older comments
I am looking at ultrasound signals using the Welch Transform in the frequency range 0 - 5 MHz, the section of code for which is below. I am getting peaks around 0-1 MHz in my results that I do not believe are real, I have corrected for the DC component by taking the mean from the data, however there is still a small peak at this frequency even when using an ideal sine wave generated in MATLAB (red box in images, Fig. 1 generated data, Fig 3. actual data). This cause significant problems due to the low signal levels in the actual data. Is there any obvious reason this is still present or how to get rid of it? Thanks
%% sample Welch
sample_line1 = datasample1transpose(1:datareclength, 1);
figure
plot(t, sample_line1);
title('Reference Pulse')
xlabel ('no of points'); grid; zoom;
no_pulses_per_line=input('Enter the number of pulses per line: ','s');
no_pulses_per_line = str2double(no_pulses_per_line);
for k = 1:no_pulses_per_line
figure
plot1 = plot(sample_line1);
title('Reference Pulse')
xlabel ('no of points'); grid; zoom;
disp('Click either side of region to zoom')
[x,y] = ginput(2);
set(gca, 'xlim',[x(1) x(2)]);
clear x y
disp('Click the start point')
[x,y] = ginput(1);
start_point = round(x(1));
%end_point =round(x(2));
end_point = start_point + 4095;
sample_section = sample_line1(start_point:end_point); [size_x, size_y] = size(sample_section); sample_section_mean_matrix = mean(sample_section).*ones(size_x, size_y); %sample_section_std_matrix = std(sample_section).*ones(size_x, size_y); sample_section_zero_mean = (sample_section - sample_section_mean_matrix); sample_section_padded = padarray(sample_section_zero_mean, 512);
Nfft = length(sample_section_padded); sample_sections (1:Nfft, k) = sample_section_padded;
end
frequency = linspace(0,sampling_freq,Nfft); freq_mhz = frequency/1000000;
Sensitivity_mhz_full = interp1(freq_profile, sensitivity, freq_mhz);
wsize = 2048; nover = wsize * 50/100; w = hann(wsize);
[welchsample, f] = pwelch(sample_sections, w, nover, frequency, sampling_freq ); % Welch's periodogram of the data welchsample1 = (sampling_freq./2).*welchsample; %% welchsampleav = mean(welchsample, 2);
welchsample1av =mean (welchsample1, 2);
welchsample1_corrected_recieve = welchsample1av'./Sensitivity_mhz_full; % correcting for sensitivity of receive probe
dBwelch = 10*log10(welchsample1_corrected_recieve);
figure plot(freq_mhz,dBwelch,'k'); title('Welch Spectrum'); xlabel('Frequency(MHz)'); ylabel('Amplitude (dB) '); set(gca,'xlim',[lower_lim upper_lim]);
1 Comment
David Morrill
on 21 Jul 2022
I am having the exact same issue, even when I subtract out the average value of the data.
I then created a dataset with DC only and it still shows the hump that you are describing. Were you able to resolve this?
Answers (1)
Chinmayi Lanka
on 18 Jan 2017
You can use the 'DCBlocker' system object that is available in the DSP System toolbox to remove the DC Component of the incoming signal. The following documentation provides a few examples on the usage of this system object: http://www.mathworks.com/help/dsp/ref/dsp.dcblocker-class.html
1 Comment
Chintan Varia
on 5 Jun 2017
Hi Chinmayi Lanka. Do you have any idea, what should be the Normalized bandwidth of lowpass IIR filter and Order of lowpass IIR elliptic filter in DC Blocker to get output signal of 50Hz? My input signal is in continuous form.
Communities
More Answers in the Power Electronics Control
See Also
Categories
Find more on Multirate Signal Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!