0
$\begingroup$

My Matlab FFT plot keeps showing the mirrored values of my frequency of interest. In this example I am looking for 250Hz with a 3200Hz sampling freq. The FFT plots my value at 266Hz as well as 1330 Hz. I assume my sampling freq is a little off which is why it isn't exactly at 250Hz. Matlab code is below, any help is appreciated.

% Tmax = (N-1)*Ts
% largest freq = Fs/2
% smalles = -fs/2

fid = fopen('250Hz.bin');
AA = fread(fid, 'short');
length(AA);
flenbytes = ftell(fid);
flenshorts = floor(flenbytes/2);
FF = floor(flenshorts/16)*16;
fseek(fid,0, 'bof');
BB = fread(fid, [8 (FF/8)], 'short');
CC = BB';
DataSet = CC ./2^3;
Z1Axis = DataSet(:,4);

N = length(DataSet)
Fs = 3200;
ts = 1/Fs;
tmax = (N-1)*ts; 
t = 0:ts:tmax;  %start at 0 increment by ts up to tmax
plot(t,Z1Axis)

f = (0:N-1)*(Fs/N)/2; % start with -Fs/2, increment by Fs/(N-1), goes to Fs/2
z = fft(Z1Axis);
%zreal =
%plot(f,z)
plot(f,abs(z));
$\endgroup$
1
$\begingroup$

It is a mathematical property of the DFT that its output is conjugate symmetric if its input is real-valued. That means that for the magnitude of the DFT output signal $X_k$ of length $N$ it holds $$ |X_{N-k}| = |X_k|. $$ So what you see is to be expected. (In your example $3200\,\mathrm{Hz}/2 - 266\,\mathrm{Hz}\approx1330\,\mathrm{Hz})$ If you're only interested in the positive frequencies, just plot the first $N/2$ elements of the DFT output, the rest is redundant.

$\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.