# Spectrogram [Array] to 3D spectrogram, Listplot3d

29

I have a question in `wolfram mathematica` . What happens is that I have an array of data and I can generate a `espectrograma` , what I need is to generate this same spectrogram in 3 dimensions,

2D Spectrogram

3D Spectrogram (which I want to obtain)

What I want is to achieve something like in the following image

I have achieved this with files `.WAV` but not with an excel column with data, which matters to mathematica, I only managed to apply filters and make `spectrograma` in 2D. If someone could give me a little help I would appreciate it. Thank you very much.

Edit (I'll add what I have regarding the question)

I'm using the code that is in the following link, but I think I do not understand the input parameters for the function, I can not make it work for the .csv file. It is likely that I am doing everything wrong and this is not the function I should use, I have also tried ListPointPlot3D without results (I only manage to graph the 2D spectrogram), but here they import a file. WAV

Attachment the link of the file ruido.scv (file of values separated by commas) that is what I need to graph

And finally the lines of code to import the file to Wolfram

``````datosExcel = Import["C:\ruta_del_archivo.csv"]
datosExcel = datosExcel[[All, 1]]
``````

asked by SeveredementiA 18.12.2015 в 17:58
source

2

The problem is the distribution of the data, to use ListPointPlot3D must be adjusted to a format. So first, with the data you have, you must know what each data is, I downloaded the data and since they are not exactly divisible into three parts I assume that they are not coordinate data (x, y, z).

The idea I suppose is that each value represents a magnitude in z, so each value must be associated with a coordinate (x, y), if we assume the base of the surface is a square in (x, y), then discarding some data you can adjust the data to the appropriate format (x, y, z) and get the graph with the following code:

``````directorio = NotebookDirectory[]; (*Obtiene el directorio donde está este notebook*)
datosExcel = Import[directorio <> "ruido.csv"];(*El archivo está en el mismo directorio*)
datosExcel = datosExcel[[All, 1]];
nD = Length[datosExcel];(*Número de datos*)
n =  IntegerPart[Sqrt[nD]]
Flatten[Table[{j, i, datosExcel[[j + (i - 1)*n]]}, {i, n}, {j,n}], 1] // ListPointPlot3D
``````

If you use the ListPlot3D command in exchange for ListPointPlot3D , the result looks better. To make the code less dark, the last line can be restated using:

``````datosFormateados=Flatten[Table[{j/10, i/10, datosExcel[[j + (i - 1)*n]]}, {i, n}, {j,n}], 1]
ListPlot3D[datosFormateados, ColorFunction -> "BlueGreenYellow"]
``````

And as it was interesting, doing a fourier analysis of the information, it is clear that a dominant frequency is seen in the harmonic 7, in other words, it is as if every 7 parts of the data the information is similar, so same if you want to appreciate the data with a better regularity you can make the graph by segmenting it in 7 rows and graphing them:

``````datosFormateados = Flatten[Table[{j, i, datosExcel[[j + (i - 1)*nD/7]]}, {i, 7}, {j, nD/7}], 1];
ListPlot3D[datosFormateados, ColorFunction -> "BlueGreenYellow"]
``````

The result looks great, you gave me something to entertain me with this morning.

answered by 30.11.2016 в 16:20