Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hello experts, I got this piece of code for the lowpass filter on the internet, my question is what should I change in the code
Hello experts,
I got this piece of code for the lowpass filter on the internet, my question is what should I change in the code if I have two variables named A and B imported from an Excel file(containing a large set of data) into MATLAB in order to filter out the noise in the signal?
Thank you in advance
>> Fs = 100; >> T = 1/Fs; >> t = 0:T:1-T; >> S = sin(2*pi*10*t); >> noise = 0.5*randn (size(t)); >> x = s + noise; >> plot (x) >> shg >> plot (x) d = designfilt('lowpassfir', 'Filterorder', 5, 'Cutofffrequency', 11, SampleRate', Fs); >> y = filter (d, x); >> plot (y) >> plot(x); hold on; plot (y) >> d = designfilt('lowpassfir', 'Filterorder', 8, 'CutoffFrequency', 10, 'SampleRate', Fs); >> y = filter (d, x); >> plot (x); hold on; plot (y) >> plot (x); hold on; plot (y) >> y = filtfilt(d, x); >> plot (x); hold on; plot(y) >> mean(y) >> Fs = 100; >> T = 1/Fs; >> t = 0:T:1-T; >> S = sin(2*pi*10*t); >> noise = 0.5*randn (size(t)); >> x = s + noise; >> plot (x) >> shg >> plot (x) d = designfilt('lowpassfir', 'Filterorder', 5, 'Cutofffrequency', 11, SampleRate', Fs); >> y = filter (d, x); >> plot (y) >> plot(x); hold on; plot (y) >> d = designfilt('lowpassfir', 'Filterorder', 8, 'CutoffFrequency', 10, 'SampleRate', Fs); >> y = filter (d, x); >> plot (x); hold on; plot (y) >> plot (x); hold on; plot (y) >> y = filtfilt(d, x); >> plot (x); hold on; plot(y) >> mean(y)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started