HW10
Jump to navigation
Jump to search
Problem Statement
Present an Octave (or MATLAB) example using the discrete Fourier transform (DFT).
Solution
I decided to show a cross correlation example using MATLAB.
close all clear all f = 2; % sine wave frequency tmax = 2; % go to 2 seconds theta = pi/4; T = 0.01; t = 0:T:tmax; N = length(t); Nmat = 0:N-2; Zmat = Nmat *0; sig1 = sin(2*pi*f*t); % A alpha signal sig2 = sin(2*pi*f*t); % A beta signal c= conv(sig1,sig2); %test of matrix size %zeropad both vectors to length N1+N2-1 to avoid cyclic convolution sigA = fft([sig1 Zmat]); sigB = fft([sig2 Zmat]); sigC = real(ifft(sigA.*sigB));
To be completed later tonight