remove DC offset for a interference signal

5 ビュー (過去 30 日間)
Vivian Yu
Vivian Yu 2021 年 12 月 15 日
回答済み: Image Analyst 2021 年 12 月 15 日
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);

採用された回答

Image Analyst
Image Analyst 2021 年 12 月 15 日
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;

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by