Vous êtes sur la page 1sur 4

Assignment 2 1.

Explain what do these functions do: linspace()


generates linearly spaced vectors. It is similar to the colon operator ":", but gives direct control over the number of points. y = linspace(a,b) generates a row vector y of 100 points linearly spaced between and including a and b. y = linspace(a,b,n) generates a row vector y of n points linearly spaced between and including a and b. For n < 2, linspace returns b.

filter()

filters a data sequence using a digital filter which works for both real and complex inputs. The filter is a direct form II transposed implementation of the standard difference equation.

butter() designs lowpass, bandpass, highpass, and bandstop digital and analog Butterworth filters. Butterworth filters are characterized by a magnitude response that is maximally flat in the passband and monotonic overall. fftshift() to rearranges the outputs of fft, fft2, and fftn by moving zero-frequency component to the center of the array. It is useful for visualizing a Fourier transform with the zero-frequency component in the middle of the spectrum. psd()

the power spectral density (PSD) is intended for continuous spectra. The integral of the PSD over a given frequency band computes the average power in the signal over that frequency band. In contrast to the mean-squared spectrum, the peaks in this spectra do not reflect the power at a given frequency.

2.

[h,w] = freqz(H) returns the complex, 8192element frequency response vector h, and the corresponding frequencies w in radians/sample. [h,w] = freqz(H,n) returnsthe complex, n-element frequency response vector h,and the corresponding frequencies w in radians/sample,using n samples. [h,w] = freqz(H,Name,Value) returns the frequency response and the corresponding frequencies, with additional options specified by one or more Name, Value pair arguments. freqz(H) uses FVToolto plot the magnitude and unwrapped phase of the frequency responseof the filter System object H. (3 marks) What is the function of Butterworth filter and how does it work? Is a type of signal processing filter designed to have as flat a frequency response as possible in the passband. It is also referred to as a maximally flat magnitude filter.

freqz()

Butterworth stated that: An ideal electrical filter should not only completely reject the unwanted frequencies but should also have uniform sensitivity for the wanted frequencies. Such an ideal filter cannot be achieved but Butterworth showed that successively closer approximations were obtained with increasing numbers of filter elements of the right values. At the time, filters generated substantial ripple in the passband, and the choice of component values was highly interactive. Butterworth showed that a low pass filter could be designed whose cutoff frequency was normalized to 1 radian per second and whose frequency response (gain) was

where is the angular frequency in radians per second and n is the number of poles in the filterequal to the number of reactive elements in a passive filter. If = 1, the amplitude response of this type of filter in the passband is 1/2 0.707, which is half power or 3 dB. Butterworth only dealt with filters with an even number of poles (2 marks)

3.

What can you conclude about the PSD and white Gaussian noise? PSD: describes how the power of a signal or time series is distributed over the different frequencies White Gaussian noise: a channel model in which the only impairment to communication is a linear addition of wideband or white noise with a constant spectral density (expressed as watts per hertz of bandwidth) and a Gaussian distribution of amplitude. (1 marks) Define pwelch(). Using example 1 and 2, compare psd() and pwelch(). (4 marks) Pxx = pwelch(x) estimates the power spectrum of the sequence x using the Welch method of spectral estimation. If x is real, pwelch estimates the spectrum at positive frequencies only; in this case, output Pxx is a column vector of length nfft/2+1 for nfft even and (nfft+1)/2 for nfft odd. If x is complex, pwelch estimates the spectrum at both positive and negative frequencies and Pxx has length nfft. Example of Psd():
o o o o o o o o Fs = 32e3; t = 0:1/Fs:2.96; x = cos(2*pi*t*1.24e3)+ cos(2*pi*t*10e3)+ randn(size(t)); nfft = 2^nextpow2(length(x)); Pxx = abs(fft(x,nfft)).^2/length(x)/Fs; % Create a single-sided spectrum Hpsd = dspdata.psd(Pxx(1:length(Pxx)/2),'Fs',Fs); plot(Hpsd);

4.

Example of pwelch(): o o o o o o rng default; Fs = 1000; t = 0:1/Fs:1-(1/Fs); % 200Hz cosine + noise x = cos(2*pi*t*200) + randn(size(t)); pwelch(x,128,120,length(x),Fs,'onesided')

Vous aimerez peut-être aussi