implementing a "first difference" filter in Matlab defined by a difference equation.
Ältere Kommentare anzeigen
Hi all
I am a student in a digital signal processing module and I am stuck on the final question of a lab session and I am not sure if my understanding is correct, i have already tried asking the lab tutor for help via email but no reply (he's a PHD candidate). the difference equation is shown below.
y[n] = x[n] - x[n -1]
He tells us its simple and can be achieved with one line of code.
My code is shown below, my understanding is its a second order difference equation.
FD = repmat(1/2,1,2); %repmat creates large matrix of 1 row by 2 columns (every coefficient value 1/2=0.5) FD_Filtered = firfilt(FD, x); %filtering input signal x with FD filter
Any advice will be greatly appreciated.
Thanks in advance,
Ben
Antworten (2)
Wayne King
am 24 Okt. 2013
No, I just mean filter(). A causal N-point moving average filter just has filter coefficients of 1/N
b = 1/N*ones(N,1);
1 Kommentar
Wayne King
am 24 Okt. 2013
0 Stimmen
Why do you believe it's a second order difference equation?
Since it is a homework problem, I do not want to simply give you the answer, but look at filter()
He is correct in telling you that you can do it easily with one line of code.
1 Kommentar
Ben
am 24 Okt. 2013
Kategorien
Mehr zu Digital Filter Analysis finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!