Creating Low Pass Filter for Time vs. Volts

I have a data set of time vs. volt obtained using an ossiliscope.
This data was imported to matlab and columns were extracted and the signal was plotted:
raw_time = raw_data(:,1);
voltage = raw_data(:,2);
plot(raw_time,voltage)
It then had to be normalized:
newtimeraw = ((raw_time - min(raw_time))/(max(raw_time)-min(raw_time)))*6;
The normalized signal was plotted:
plot(newtimeraw,voltage)
I am trying to create a low pass filter for the normalized signal and then apply a fourier transform. This is the code I have but I am genuinely lost, and am almost positive most of this code is incorrect in one way or another.
syms a b
fc = 1
fs = length(newtimeraw)/(max(newtimeraw)-min(newtimeraw))
signal = [newtimeraw,voltage]
[b,a] = butter(2,(fc/(fs/2)), 'low')
filtered_signal = filter(b,a,signal)
figure
freqz(b,a)
figure
subplot(2,1,1)
plot(newtimeraw,voltage)
subplot(2,1,2)
plot(newtimeraw,filtered_signal)
F_sig = 2*abs(fft(raw_data))/length(raw_data);
F_Fsig = 2 *abs(fft(filtered_signal))/length(filtered_signal);
freqVector = linspace(0, fs/2, length(filtered_signal/2+1));
figure
semilogx(freqVector,F_Fsig(1:end/2)+1)

댓글 수: 2

Star Strider
Star Strider 2019년 12월 7일
Two observations:
1) Do not use the Symbolic Math Toolbox for this!
2) a second-order Butterworth lowpass filter is not going to do much to filter your signal.
Navya Seelam
Navya Seelam 2019년 12월 10일
Why are you trying to filter time i.e newtimeraw in the line 6 ? Aren't you trying to filter the voltage?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

질문:

2019년 12월 7일

댓글:

2019년 12월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by