Trying to perform Fast Fourier Transform

2 visualizaciones (últimos 30 días)
Ryan
Ryan el 1 de Dic. de 2022
Respondida: Walter Roberson el 1 de Dic. de 2022
I imported some data and tried to use the fft function on it to perform a fast fourier transform. When I run the code, an error comes saying the argument must be one of many listed data types, including a double, of which the data is (16384x1).
vtx_30 = importdata("M006_vortex_30.txt")
vtx_45 = importdata("M006_vortex_45.txt");
vtx_30 = fft(vtx_30)
What seems to be the issue?

Respuesta aceptada

Walter Roberson
Walter Roberson el 1 de Dic. de 2022
importdata() can return any of three different data types, depending on the content of the file.
If the file is text and has at least one header line or one comment anywhere in the file, then importdata() will return a struct with fields textdata and data with the textdata field containing the text that was read, and with data containing the numeric array.
If that is what happened then you would be trying to perform fft() on a struct rather than on the numeric data.
We recommend against using importdata() because it is too unreliable that way, too many cases you have to think to test for afterwards. Use readmatrix() or readtable() instead.

Más respuestas (0)

Categorías

Más información sobre Fourier Analysis and Filtering en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by