Help plotting FFT from column vector with real and imaginary parts.
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Robert Evans
le 30 Nov 2015
Commenté : Joseph Nichols
le 24 Juin 2023
Hello, I'm attempting to plot the fft from the data taken from an oscilloscope and saved in Excel.
I've saved the data in matlab as a column vector with 200 data points of real and imaginary parts, called 'data', and I'm trying to get an accurate FFT plot. The plot that comes out doesn't look like the FFT spikes I'm expecting; rather its just a strange squiggle. I was wondering if anybody has any insight into what I'm doing wrong. My code is:
>> freq = fft (data)
freq =
-1.2128 + 0.0000i
2.1644 + 5.0673i
0.2578 + 1.0098i
0.0654 + 0.6253i
0.0270 + 0.4352i
0.0174 + 0.3877i
0.0068 + 0.3035i
-0.0008 + 0.2554i
-0.0048 + 0.2123i
-0.0101 + 0.1999i
0.0021 + 0.1944i
-0.0191 + 0.1507i
-0.0352 + 0.1421i
-0.0275 + 0.1331i
-0.0235 + 0.1287i
-0.0528 + 0.1290i
-0.0094 + 0.0996i
-0.0388 + 0.0833i
-0.0216 + 0.0892i
-0.0338 + 0.0902i
-0.0159 + 0.0837i
-0.0284 + 0.0609i
-0.0360 + 0.0834i
-0.0358 + 0.0962i
-0.0206 + 0.0791i
-0.0261 + 0.0670i
-0.0314 + 0.0603i
-0.0204 + 0.0536i
-0.0122 + 0.0511i
-0.0247 + 0.0404i
-0.0297 + 0.0425i
-0.0275 + 0.0417i
-0.0325 + 0.0510i
-0.0250 + 0.0568i
-0.0192 + 0.0415i
-0.0296 + 0.0531i
-0.0199 + 0.0475i
-0.0255 + 0.0470i
-0.0340 + 0.0470i
-0.0225 + 0.0298i
-0.0254 + 0.0361i
-0.0179 + 0.0413i
-0.0312 + 0.0294i
-0.0364 + 0.0124i
-0.0237 + 0.0331i
-0.0264 + 0.0207i
-0.0172 + 0.0344i
-0.0181 + 0.0243i
-0.0486 + 0.0343i
-0.0056 + 0.0411i
-0.0436 + 0.0328i
-0.0230 + 0.0237i
-0.0372 + 0.0243i
-0.0291 + 0.0368i
-0.0212 + 0.0038i
-0.0266 + 0.0212i
-0.0309 + 0.0148i
-0.0411 + 0.0130i
-0.0279 + 0.0245i
-0.0151 + 0.0134i
-0.0347 + 0.0158i
-0.0324 + 0.0211i
-0.0287 + 0.0202i
-0.0305 + 0.0307i
-0.0145 + 0.0180i
-0.0227 + 0.0106i
-0.0480 + 0.0169i
-0.0270 + 0.0098i
-0.0301 + 0.0193i
-0.0271 + 0.0160i
-0.0410 + 0.0047i
-0.0239 + 0.0182i
-0.0198 + 0.0074i
-0.0419 + 0.0206i
-0.0228 + 0.0139i
-0.0150 + 0.0014i
-0.0281 + 0.0141i
-0.0280 + 0.0145i
-0.0460 + 0.0218i
-0.0194 + 0.0152i
-0.0303 - 0.0020i
-0.0215 + 0.0226i
-0.0372 - 0.0002i
-0.0243 + 0.0146i
-0.0262 + 0.0152i
-0.0350 + 0.0149i
-0.0252 + 0.0092i
-0.0154 + 0.0027i
-0.0391 - 0.0037i
-0.0301 + 0.0099i
-0.0439 - 0.0088i
-0.0103 + 0.0423i
-0.0094 - 0.0096i
-0.0434 + 0.0049i
-0.0310 + 0.0006i
-0.0493 + 0.0002i
0.0009 + 0.0156i
-0.0324 - 0.0052i
-0.0360 + 0.0146i
-0.0138 - 0.0139i
-0.0548 + 0.0000i
-0.0138 + 0.0139i
-0.0360 - 0.0146i
-0.0324 + 0.0052i
0.0009 - 0.0156i
-0.0493 - 0.0002i
-0.0310 - 0.0006i
-0.0434 - 0.0049i
-0.0094 + 0.0096i
-0.0103 - 0.0423i
-0.0439 + 0.0088i
-0.0301 - 0.0099i
-0.0391 + 0.0037i
-0.0154 - 0.0027i
-0.0252 - 0.0092i
-0.0350 - 0.0149i
-0.0262 - 0.0152i
-0.0243 - 0.0146i
-0.0372 + 0.0002i
-0.0215 - 0.0226i
-0.0303 + 0.0020i
-0.0194 - 0.0152i
-0.0460 - 0.0218i
-0.0280 - 0.0145i
-0.0281 - 0.0141i
-0.0150 - 0.0014i
-0.0228 - 0.0139i
-0.0419 - 0.0206i
-0.0198 - 0.0074i
-0.0239 - 0.0182i
-0.0410 - 0.0047i
-0.0271 - 0.0160i
-0.0301 - 0.0193i
-0.0270 - 0.0098i
-0.0480 - 0.0169i
-0.0227 - 0.0106i
-0.0145 - 0.0180i
-0.0305 - 0.0307i
-0.0287 - 0.0202i
-0.0324 - 0.0211i
-0.0347 - 0.0158i
-0.0151 - 0.0134i
-0.0279 - 0.0245i
-0.0411 - 0.0130i
-0.0309 - 0.0148i
-0.0266 - 0.0212i
-0.0212 - 0.0038i
-0.0291 - 0.0368i
-0.0372 - 0.0243i
-0.0230 - 0.0237i
-0.0436 - 0.0328i
-0.0056 - 0.0411i
-0.0486 - 0.0343i
-0.0181 - 0.0243i
-0.0172 - 0.0344i
-0.0264 - 0.0207i
-0.0237 - 0.0331i
-0.0364 - 0.0124i
-0.0312 - 0.0294i
-0.0179 - 0.0413i
-0.0254 - 0.0361i
-0.0225 - 0.0298i
-0.0340 - 0.0470i
-0.0255 - 0.0470i
-0.0199 - 0.0475i
-0.0296 - 0.0531i
-0.0192 - 0.0415i
-0.0250 - 0.0568i
-0.0325 - 0.0510i
-0.0275 - 0.0417i
-0.0297 - 0.0425i
-0.0247 - 0.0404i
-0.0122 - 0.0511i
-0.0204 - 0.0536i
-0.0314 - 0.0603i
-0.0261 - 0.0670i
-0.0206 - 0.0791i
-0.0358 - 0.0962i
-0.0360 - 0.0834i
-0.0284 - 0.0609i
-0.0159 - 0.0837i
-0.0338 - 0.0902i
-0.0216 - 0.0892i
-0.0388 - 0.0833i
-0.0094 - 0.0996i
-0.0528 - 0.1290i
-0.0235 - 0.1287i
-0.0275 - 0.1331i
-0.0352 - 0.1421i
-0.0191 - 0.1507i
0.0021 - 0.1944i
-0.0101 - 0.1999i
-0.0048 - 0.2123i
-0.0008 - 0.2554i
0.0068 - 0.3035i
0.0174 - 0.3877i
0.0270 - 0.4352i
0.0654 - 0.6253i
0.2578 - 1.0098i
2.1644 - 5.0673i
>> plot (freq)
Any help would be appreciated.
0 commentaires
Réponse acceptée
Rick Rosson
le 1 Déc 2015
Modifié(e) : Rick Rosson
le 1 Déc 2015
N = length(data);
freq = fftshift(fft(data))/N;
plot(abs(freq));
1 commentaire
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Fourier Analysis and Filtering dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!