0
$\begingroup$

I created a signal with two sinusoidal components by specifying

$$ f(t) = \cos(2\pi*4t)*5\cos(2\pi*0.4t) $$

I expected with I used MatLab's fft function on this that signal that I would see a peak of amplitude $1$ at a position of 4Hz in the spectrum corresponding to the 'fast' signal which has frequency $4$, and a peak of amplitude $5$ at a position of 0.4Hz in the spectrum corresponding to the 'slow' signal which has frequency $0.4$.

In my code below, subplots 3 and 4 are the fft plots, 3 is the unshifted one, and 4 is the shifted one. As you can see from running the code, I do not get the results I expected!

It seems I have peaks at $4+0.4=4.4$ Hz and $4-0.4=3.6$ Hz, and although the scaling is off with the amplitude, both peaks are the same height.

I thought the Fourier Transform would pick up the oscillations at 4Hz and 0.4Hz individually, and display them with their correct (relative) amplitudes? What has gone wrong?

function FFT_4()
clc
clear all
close all

sigFreq = 4;
f = @(t) cos(2*pi*sigFreq*t)*5.*cos(2*pi*0.1*sigFreq*t);

%% Calculation for samFreq > 2*sigFreq: Higher resolution
samFreq = 12;
[t,S,omega,power,fshift,powershift] = CalcFFT(f, samFreq);
plotSignalandFFTSignal(4,t,S,omega,power,fshift,powershift)

end

function [t,S,omega,power,omegashift,powershift] = CalcFFT(f, samFreq)
t = 0:(1/samFreq):(10-1/samFreq); % time vector
S = f(t);
n = length(S);
X = fft(S);
Y = fftshift(X);
omega = (0:n-1)*(samFreq/n);     %frequency range
power = abs(X).^2/n;    %power
omegashift = (-n/2:n/2-1)*(samFreq/n); % zero-centered frequency range
powershift = abs(Y).^2/n;
end

function plotSignalandFFTSignal(figNum,t,S,f,power,fshift,powershift)
figure(figNum)
subplot(2,2,1); plot(t,S); % xlim([0,1])
subplot(2,2,2); plot(power)
subplot(2,2,3); plot(f,power)
subplot(2,2,4); plot(fshift,powershift)
end

enter image description here

$\endgroup$
1
$\begingroup$

Fourier Transform is linear transform. It is mean that Fourier Transforms of sum of functions will be sum of Fourier Transforms of each function. It is not valid for multiply of function.

Your example. There is very well known formula (see 7c in this link): $$ \cos(\alpha) * cos(\beta) = 1/2 (\cos(\alpha+\beta) + \cos(\alpha-\beta)) $$ use this formula to transform your function: $$ f(t) = \cos(2\pi*4t)*5\cos(2\pi*0.4t) = 5/2*(\cos(2\pi*4t - 2\pi*0.4t) + \cos(2\pi*4t - 2\pi*0.4t)) = 5/2*(\cos(2\pi*3.6t) + \cos(2\pi*4.4t)) $$ So Matlab results is correct - you have 2 peaks equal amplitude with 3.6 and 4.4 frequency.

$\endgroup$
0
$\begingroup$

The Fourier transform of a product is the convolution of the transforms of the individual factors.

Your factors (ignoring the constant factor) are cosines with a frequency of 4 and a frequency of 0.4, corresponding to dirac pulse pairs at ±4 and ±0.4. Their convolution has pulses at -4.4, -3.6, 3.6, and 4.4.

So your results are pretty much as expected.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.