MATLAB Signal Processing 1 — Questions and Answers
Question 1: Which MATLAB function computes the Fast Fourier Transform of a signal vector x?
- dft(x)
- fft(x) (Correct answer)
- fourier(x)
- transform(x)
Correct answer: fft(x)
The `fft(x)` function computes the discrete Fast Fourier Transform of the input vector x in MATLAB.
Question 2: What inputs does the MATLAB `filter(b, a, x)` function require?
- Numerator coefficients b, denominator coefficients a, and input signal x (Correct answer)
- Only the input signal x and sampling frequency fs
- Filter order N and cutoff frequency Wn only
- Transfer function H and sampling rate fs
Correct answer: Numerator coefficients b, denominator coefficients a, and input signal x
`filter(b, a, x)` applies a digital filter defined by numerator coefficients b and denominator coefficients a to the signal x.
Question 3: According to the Nyquist-Shannon theorem, what is the minimum sampling rate required to reconstruct a signal with maximum frequency f_max?
- f_max
- f_max / 2
- 2 * f_max (Correct answer)
- 4 * f_max
Correct answer: 2 * f_max
The Nyquist theorem states the sampling rate must be at least twice the highest frequency component (2 * f_max) to avoid aliasing.
Question 4: Which MATLAB function designs a FIR filter using the window method given filter order n and normalized cutoff frequency Wn?
- butter(n, Wn)
- fir1(n, Wn) (Correct answer)
- cheby1(n, Rp, Wn)
- ellip(n, Rp, Rs, Wn)
Correct answer: fir1(n, Wn)
`fir1(n, Wn)` designs a windowed linear-phase FIR filter of order n with normalized cutoff frequency Wn.
Question 5: What does the MATLAB `freqz(b, a)` function compute?
- The frequency response of a digital filter defined by coefficients b and a (Correct answer)
- The zero-frequency component of the FFT
- The resonant frequency of an analog filter
- The resampled signal at a new frequency
Correct answer: The frequency response of a digital filter defined by coefficients b and a
`freqz(b, a)` computes and plots the magnitude and phase frequency response of the digital filter with coefficients b and a.
Question 6: Which MATLAB function computes the linear convolution of two discrete-time sequences u and v?
- xcorr(u, v)
- dot(u, v)
- conv(u, v) (Correct answer)
- convolve(u, v)
Correct answer: conv(u, v)
`conv(u, v)` returns the convolution of vectors u and v, producing an output of length length(u)+length(v)-1.
Question 7: In MATLAB, how do you generate a 1 Hz sine wave sampled at 100 Hz for 1 second?
- x = sin(2*pi*1*t); where t = 0:1/100:1 (Correct answer)
- x = sin(t); where t = linspace(0,100,1)
- x = sinc(t); where t = 0:1:100
- x = cos(2*pi*100*t); where t = 0:1/1:1
Correct answer: x = sin(2*pi*1*t); where t = 0:1/100:1
A 1 Hz sine wave requires `sin(2*pi*f*t)` with f=1 and a time vector t sampled at 100 Hz (step = 1/100).
Which MATLAB function computes the Fast Fourier Transform of a signal vector x?