How to make this signal linear

10 visualizaciones (últimos 30 días)
James Adams
James Adams el 20 de Feb. de 2020
Comentada: Star Strider el 22 de Feb. de 2020
Here is my code so far on how to produce this plot. Any ideas on how to make this plot linear?
A = dlmread('signal_2.txt'); %Reads signal data file
x= A(:,1); %Time Variables
y= A(:,2); %Amplitude variables
Many Thanks

Respuesta aceptada

Star Strider
Star Strider el 20 de Feb. de 2020
If you want to eliminate the low-frequency parabolic(?) trend, the easiest way is to use a digital filter:
signal_2 = load('signal_2.txt');
t = signal_2(:,1);
signal = signal_2(:,2);
figure
plot(signal_2(:,1), signal_2(:,2))
grid
xlabel('Time')
ylabel('signal')
L = numel(t);
Ts = mean(diff(t));
Fs = 1/Ts;
Fn = Fs/2;
FTsignal = fft(signal)/L;
Fv = linspace(0, 1, fix(L/2)+1)*Fn;
Iv = 1:numel(Fv);
figure
plot(Fv, abs(FTsignal(Iv))*2)
grid
title('Fourier Transform: ‘signal’')
xlabel('Frequency')
ylabel('Amplitude')
Wp = [25 75]/Fn; % Normailsed Passband (Passband = 25 Hz To 75 Hz)
Ws = [20 80]/Fn; % Normailsed Stopband (Passband = 20 Hz To 80 Hz)
Rp = 1; % Passband Ripple/Attenuation
Rs = 50; % Stopband Ripple/Attenuation
[n,Wp] = ellipord(Wp, Ws, Rp, Rs); % Calculate Elliptic Filter Optimum Order
[z,p,k] = ellip(n, Rp, Rs, Wp,'bandpass'); % Elliptic Filter
[sos,g] = zp2sos(z,p,k); % Second-Order-Section For Stability
Filtered_signal = filtfilt(sos,g,signal); % Filter
figure
plot(t, Filtered_signal)
grid
xlabel('Time')
ylabel('Filtered\_signal')
producing:
This filter also eliminates some of the high-frequency noise as well.

Más respuestas (1)

James Adams
James Adams el 22 de Feb. de 2020
Thanks for the help, this is really detailed and has helped a lot. :)
  1 comentario
Star Strider
Star Strider el 22 de Feb. de 2020
As always, my pleasure!
The filter eliminates low-frequency baseline drift and all baseline offset, regardless of the nature or shape of the wandering baseline.

Iniciar sesión para comentar.

Categorías

Más información sobre Single-Rate Filters en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by