MATLAB Answers

0

Isolating a single pulse by removing noise

Hans123 님이 질문을 제출함. 13 Sep 2019
최근 활동 Star Strider 님이 댓글을 추가함. 13 Sep 2019
I hope my title wasn't misleading, I simply want to remove the oscillatory noise from the pulse I obtain from a monostable multivibrator.
I have attached a picture of the Time Domain waveform (which is the same as the snapshot from the o-scope) below, I want to isolate the 50ns initial pulse. I am thinking of using a low-pass filter to achieve that but inorder to do so I need to find the frequencies of the noise.
And I have attached the plots for the Frequency Domain graphs that I obtained after using FFT.
zoomed into the range of 0~20 Hz
I am having a hard time identifying which frequencies are from the noise and which frequency is that of the 50ns initial pulse that I am interested in, so I can find the ideal resistor-capacitor combination for the low pass filter to isolate the pulse from the noise
Any help would be greatly appreciated. I have attached the CSV file I obtained from the o-scope and my code incase that helps.
Thanks in advance!
clc; clear all; close all
A = dlmread("F0000CH1.CSV",",",0,3);
Time = 1e9.*A(:,1);
Voltage = A(:,2);
figure
plot(Time,Voltage,'LineWidth',2)
title('Time Domain Function')
ylabel('Voltage (V)')
xlabel('Time (ns)')
xlim([-125 400])
ylim([-4.5 6])
%frequency domain
S=numel(Time);
FFT = fft(Voltage,S);
Pyy = FFT.*conj(Voltage)/S;
f = (1000/S)*(0:floor(S/2));
figure
plot(f,Pyy(1:floor(S/2)+1))
title('Frequency Domain')
xlabel('Frequency (Hz)')
ylabel('dB/frequency')
figure
plot(f(1:50),Pyy(1:50),'LineWidth',2)
title('Frequency Domain')
xlabel('Frequency (Hz)')
ylabel('dB/frequency')

  댓글 수: 0

로그인 to comment.

답변 수: 1

Star Strider 님의 답변 13 Sep 2019
 채택된 답변

Try this:
A = dlmread('F0000CH1.csv',",",0,3);
Time = 1e9.*A(:,1);
Voltage = A(:,2);
figure
plot(Time,Voltage,'LineWidth',2)
title('Time Domain Function')
ylabel('Voltage (V)')
xlabel('Time (ns)')
xlim([-125 400])
ylim([-4.5 6])
L = numel(Time); % Signal Length
Ts = mean(diff(Time)); % Sampling Interval
Fs = 1/Ts; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
FT_V = fft(Voltage)/L; % Normalised Fourier Transform
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector
Iv = 1:numel(Fv); % Index Vector
figure
plot(Fv, abs(FT_V(Iv))*2)
grid
xlim([0 0.5])
Wp = 0.045; % Passband Frequency (Normalised)
Ws = 0.050; % Stopband Frequency (Normalised)
Rp = 1; % Passband Ripple
Rs = 50; % Passband Ripple (Attenuation)
[n,Wp] = ellipord(Wp,Ws,Rp,Rs); % Elliptic Order Calculation
[z,p,k] = ellip(n,Rp,Rs,Wp); % Elliptic Filter Design: Zero-Pole-Gain
[sos,g] = zp2sos(z,p,k); % Second-Order Section For Stability
figure
freqz(sos, 2^16, Fs) % Filter Bode Plot
Voltage_filt = filtfilt(sos, g, Voltage); % Filter Signal
figure
plot(Time,Voltage_filt,'LineWidth',2)
title('Time Domain Function')
ylabel('Voltage (V)')
xlabel('Time (ns)')
xlim([-125 400])
ylim([-4.5 6])
I chose a passband frequency of 0.045 Hz and a stopband frequency of 0.050 Hz, based on the Fourier transform results, since it appeared to give good results. This code designs an 7-order elliptic filter, since these filters are efficient. Experiment with the filter characteristics to decide on the paramerers for your hardware filter.

  댓글 수: 2

wow, this is on another level! I am a newcomer to this topic and I thought I could use a simple DIY resistor-capacitor combination to remove the noise but this is complicated than that.
I am working with nanosecond pulses I should take into accound the rise and fall times of all the components that I am including in my set-up, so I am trying to find the most feasible method to tackle this issue.
As always, thank you Star Strider! I did not expect to see a Bode plot, but you always come through. Thanks again for blessing this forum!
As always, my pleasure!
I very much appreciate your compliments!

로그인 to comment.



Translated by