Download - ass1
-
ELEC4620 ASSIGNMENT 1
FARAH HANISAH WAHIZAN
42486510
University of Queensland
-
1. Multiply the following polynomials in z by using the fft algorithm (MATLAB)
1 + 21 + 42 + 53 + 114 + 255 1 41 52 + 153 134 + 195
FFT transforms a signal into frequency domain. Multiplication in frequency domain corresponds to
convolution in the time domain. Thus once the polynomials are multiplied together, it is converted into time
domain using the ifft (inverse FFT). FFT convolution in frequency domain is faster than convolution in the
time domain.
// Matlab code
>> a = [1 2 4 5 11 25];
>> b = [1 -4 -5 15 -13 19];
>> y = ifft(fft(a,11).*fft(b,11))
ans =
Columns 1 through 5
1.0000 -2.0000 -9.0000 -6.0000 -12.0000
Columns 6 through 10
9.0000 -94.0000 51.0000 327.0000 -116.0000
Column 11
475.0000
>> stem(y)
In the above Matlab code, the polynomials in z are first replaced in the form of vector v. This vector form
matches the requirement of a FFT. The Matlab code above also show that each polynomial is evaluated by
taking the DFT of each coefficient. They are then multiplied and the resulting values are interpolated by
taking the inverse FFT of point-value pairs, yielding the coefficients.
-
FFT can perform DFT and inverse DFT in time (n log n). We can also check this by using convolution,
>> a = [1 2 4 5 11 25];
>> b = [1 -4 -5 15 -13 19];
>> stem(a)
>> stem(b)
>> c = conv(a, b)
c =
Columns 1 through 10
1 -2 -9 -6 -12 9 -94 51 327 -116
Column 11
475
-
>> stem(c)
Thus from the results above, it can be shown that the FFT multiplication is similar to that of convolution.
-
2. Multiply the following base 10 numbers together and then show how the same result can be obtained via
the DFT. Explain your method.
537283 multiplied by 423715
// Matlab code
Normal multiplication
>> format long
>> 537283*423715
ans =
2.276548663450000e+11
DFT
>> c = [5 3 7 2 8 3]; /* the integers are separated into a vector
>> d = [4 2 3 7 1 5];
>> x=ifft(fft(c,11).*fft(d,11)) /* Both vectors are converted into frequency
/* domain using fft and are multiplied together. The
/* resulting values are than inverted back using ifft
x =
1.0e+02 *
Columns 1 through 2
0.200000000000000 0.220000000000000
Columns 3 through 4
0.490000000000000 0.660000000000000
Columns 5 through 6
0.830000000000000 1.110000000000000
Columns 7 through 8
0.660000000000000 1.020000000000000
Columns 9 through 10
0.390000000000000 0.430000000000000
Column 11
0.150000000000000
-
>> y = x.*10.^([11 10 9 8 7 6 5 4 3 2 1]); /* The values are then multiplied with numbers in base 10
/* taking into account the size of x.
>> y*ones(11,1) /* Matrix multiplication between y and ones(11,1) resulting
/* in an end value.
ans =
2.276548663450000e+12
Normal multiplication requires (2) multiplications. For example,
Figure 1. Normal multiplication.
This is costly for multiplications involving large integers. Multiplication using FFT is faster as it reduces the
arithmetic complexity to (n log n). In FFT Multiplication, the integers are expressed in base 10 as
mentioned in the question. Integers are treated as the value of a polynomial evaluated specifically at the
number base, with the coefficients of the polynomial corresponding to the digits in that base. After
polynomial multiplication, a relatively low-complexity carry-propagation step is carried out to complete the
multiplication. (Sathishkumar and K.Boopathy 2008)
-
3. Consider the polynomial
() = 1 + 21 + 32 + 53 + 124 + 255
a) Write down and plot the positions of all the poles and zeros (MATLAB roots/zplane).
Poles and zeros are used in determining the stability of a system and also in designing filters. The
filter that is in focus is the FIR filter due to its linear-phase characteristics. IIR filters cannot be used,
as there are no causal stable IIR filters with linear phase (constant time delay). A linear phase filter is
needed in phase sensitive applications. (Fessler 2004)
Thus, from the polynomials given above, the poles and zeros of F(z) can be plotted by designing a FIR filter.
// Matlab code
>> y = dfilt.dffir([1 2 3 5 12 25]);
>> zplane(z)
Poles : -1.926537, -1.062036 + 1.63219i, -1.062036 - 1.63219i, 1.025304 + 1.539772i,
1.025304 - 1.539772i
Zeros : 1e-50i
-
The polynomials in z are first represented in vector v form. Resulting in a vector array [1 2 3 5 12
25]. Thus the command zplane gives the poles and zeros of the FIR filter.
From Matlabs help page, DFFIR Direct-Form FIR.
Hd = DFILT.DFFIR(NUM) constructs a discrete-time, direct-form FIR filter
object Hd, with numerator coefficients NUM.
b) Evaluate |F(z)| at 256 uniformly speed points around the unit circle using the Discrete Fourier Transform
and plot the result.
From Matlabs help page, in order to evaluate |F(z)| at 256 uniformly speed points using DFT, the fft
command must be used.
FFT(X,N) is the N-point FFT, padded with zeros if X has less
than N points and truncated if it has more. X corresponds to the vector X from which the polynomials are
converted in this case, k. On the other hand, N corresponds to the number of points or vector length, 256
points.
// The following Matlab command were carried out and a plot was obtained.
>> k = [1 2 3 5 12 25]);
>> stem(abs(fft(k,256)))
-
4. Consider a 10 Hz sine wave sampled at 40 Hz. If the samples are plotted and
displayed using linear interpolation, the reconstructed waveform will not
resemble the original continuous-time sine wave. Show how sinc interpolation
can be used to reconstruct the original continuous-time signal. (Hint: In this
question you are being asked to resample the sine wave at a higher sampling
rate by sinc interpolation)
// Matlab code
>> n = [0:19]; /* 20 samples of signal
>> ab = sin(2*pi*(10/40)*n); /* Where ab = sin(2*pi*(f/Fs)*n, f = 10Hz, Fs = 40Hz.
>> stem(ab)
10Hz sine wave is smaller than the Nyquist frequency (Fs/2 = 20Hz), thus aliasing does not occur. X
obtained above is the 10Hz sine wave in time-domain.
>> ac = [ab; zeros(1,20); zeros(1,20)]; /* This adds zero padding to resample the signal.
>> ad = ac(:); /* Transpose the ac.
>> stem(ad)
-
>> m = sinc((1/3)*n)
m =
Columns 1 through 11
0.8270 0.4135 0.0000 -0.2067 -0.1654 -0.0000 0.1181 0.1034 0.0000 -0.0827 -0.0752
Columns 12 through 20
-0.0000 0.0636 0.0591 0.0000 -0.0517 -0.0486 -0.0000 0.0435 0.0413
>> stem(conv(h,xr))
From Matlabs help, SINC(X) returns a matrix whose elements are the sinc of the elements thus showing the
sinc interpolation of the signal. Thus, the whole process involves changing the signal into time-domain and
undergoing interpolation.
-
Reference
Journal
Sathishkumar, GA and Boopathy, K 2008, A Hardware implementation of Winograd Fourier Transform
algorithm for Cryptography, Ubiquitous Computing and Communication Journal, pp1.
Book
Fessler, J 2004, Chapter 8: Design of Digital Filters, viewed 16 August 2013,