Graphics Programs Reference
In-Depth Information
xlabel('Frequency')
ylabel('Power')
We add some gaussian noise with amplitude one and explore the signal and
its periodogram.
xn12 = x12 + randn(1,length(t));
plot(t,xn12), axis([0 200 -4 4])
[Pxx,f] = periodogram(xn12,[],1024,1);
plot(f,abs(Pxx))
xlabel('Frequency')
ylabel('Power')
The Butterworth fi lter design technique is a widely-used method to create
fi lters of any order with a lowpass, highpass, bandpass and bandstop con-
fi guration (Fig. 6.5). In our example, we like to design a fi ve-order lowpass
fi lter with a cutoff frequency of 0.08. The inputs of the function butter are
the order of the fi lter and the cutoff frequency normalized to the Nyquist fre-
quency, which is 0.5 in our example, that is half of the sampling frequency.
[b12,a12] = butter(5,0.08/0.5);
The frequency characteristics of the fi lter shows a relatively smooth transi-
tion from the passband to the stopband, but the advantage of the fi lter is its
low order.
[h,w] = freqz(b12,a12,1024);
f = w/(2*pi);
plot(f,abs(h)), grid
xlabel('Frequency')
ylabel('Magnitude')
We can again apply the fi lter to the signal by using the function filter .
However, frequency selective fi lters such as lowpass, highpass, bandpass
and bandstop are designed to suppress certain frequency bands, whereas
phase shifts should be avoided. The function filtfilt provides zero-phase
forward and reverse digital fi ltering. After fi ltering in the forward direction,
the fi ltered sequence is reversed and it runs back through the fi lter. The mag-
nitude of the signal is not affected by this operation, since it is either 0 or
100% of the initial amplitude, depending of the frequency. In contrast, all
phase shifts introduced by the fi lter are zeroed by the forward and reverse
application of the same fi lter. This function also helps to overcome the prob-
lems with causal indexing of fi lters in MATLAB. It eliminates the phase
Search WWH ::




Custom Search