remove DC offset for a interference signal

30 visualizzazioni (ultimi 30 giorni)
Hi,
Could you please tell me how to remove DC offset for a interference signal?
I think the DC offset of my signal is not a constant.
Therefore, "signal-mean(signal)" is not quite accurate.
filename = ('waveform.xlsx');
data = xlsread(filename);
time = data(:,1);
signal = data(:,2);

Risposta accettata

Image Analyst
Image Analyst il 15 Dic 2021
Try this:
filename = ('waveform.xlsx');
data = xlsread(filename);
times = data(:,1);
signal = data(:,2);
% Plot it.
subplot(2, 1, 1);
plot(signal, 'b-')
% Find data points more than 1000 in value and fit a quaratic through them
mask = signal > 1000;
maskedTimes = times(mask);
maskedSignal = signal(mask);
coefficients = polyfit(maskedTimes, maskedSignal, 2);
% Get smoothed signal.
smoothedSignal = polyval(coefficients, times);
hold on;
plot(smoothedSignal, 'r-', 'LineWidth', 3)
grid on
% Now subtract the mean
signal2 = signal - smoothedSignal;
% Plot it.
subplot(2, 1, 2);
plot(signal2, 'b-')
% Plot line across the x axis
yline(0, 'LineWidth', 2)
grid on;

Più risposte (0)

Categorie

Scopri di più su Signal Generation and Preprocessing in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by