How can I Plot spectrogramm with Excel File

7 views (last 30 days)
Dear all I Have a Excel sheet with a dimension 10082*36 the 10082 represent the Time and the 36 represent Supraharmonic frequency 2 kHz-150 kHz (columns: 2 kHz,4 kHz,6 kHz.......150 kHz=36columns) i Want Dislay this Excel-Sheet in Matlab With Spectrogramm Plot. All the Commands and Syntaxes in Matlab Documetation were for a wave file . i had already import the Data from Excel to Matlab %filename = 'Ladestation Mittelwert' %omega=xlsread(filename) %A=omega(1:10080,1:36) but now i don't know how i kann plot this Matrix(omega) in Spectrogramm Diagramm with x-axis represent the time (1:10080 a Week ) and the y-Axis represent the the Frequency from 2 kHz to 150 kHz Color in the Spectrogramm represent the Amplitude (Voltage Harmonic )in V or in Dbv i Want habe a plot like this Pic it very Helpful for when you can Help me i need this for my thesis thank you

Accepted Answer

Star Strider
Star Strider on 7 Dec 2017
From your description, it seems that you have already created the spectrogram information.
The MATLAB spectrogram function plots it as a surf plot with view([0 90]). Import your Excel file using xlsread and plot it similarly. See the documentation on the surf (link) function for details.

More Answers (3)

houssem chedli
houssem chedli on 7 Dec 2017
Edited: Star Strider on 7 Dec 2017
thanks for the quick answer I had already the Plot with the Surf function in 3 D but with the view [0 90] i can't see the spectrum the Plot Display was Dark Code
%%Daten einlesen
omega=xlsread(filename);
[z,s]=size(omega);
t=1:1:10078; %zeitvektor im Minutenvektor
f=2:0.2:9; %frequenz im Abstand von 200 hz
A=omega(1:10078,1:36);%einlesen von erste Matrix Messwerte für Leiter 1
surf(f,t,A)
view(0,90)%
i want that the Color in spectrogramm was Clear like in the Exemple File thanks Again
  1 Comment
Star Strider
Star Strider on 7 Dec 2017
I am not certain what the problem could be, since I do not have your matrix. It is difficult to read the chart, however the spectrogram data corresponding to your ‘omega’ appear to be in decibels.
If your data are not already in decibels, try this:
A = 20*log10(abs(omega(1:10078,1:36)));%einlesen von erste Matrix Messwerte für Leiter 1

Sign in to comment.


houssem chedli
houssem chedli on 7 Dec 2017
Edited: houssem chedli on 7 Dec 2017
<<
>>
I have attached you a Excel File but only one Day (my Normal Excel Data have 7 day ) the File has a big size i Can't put it her. the 'Surf' give me alL the Time a Dark Plot (See pic spectrogram) it ist possibol to give a Voltage Value a specific Color? i mean[0V/ 1V] Blue volte or dbv [1V 2V] green [2V 4V] red the Excel file in the attachement and the Dark Plot it also her I thank you so Much
%filename = 'Beispiel';
% Daten einlesen omega=xlsread(filename); [z,s]=size(omega); A=omega(1:10080,1:36) t=1:1:1440; %zeitvektor im Minutenvektor f=2:0.2:9; %frequenz im Abstand von 200 hz A = 20*log10(abs(omega(1:1440,1:36))) surf(f,t,A) view(0,90)
%
  3 Comments

Sign in to comment.


houssem chedli
houssem chedli on 7 Dec 2017
the Dark Plot with surf sorry the Excel file can#t be attached i took a pick of the Excel sheet .itwill be seem all of them Like this Pic
  1 Comment
Star Strider
Star Strider on 8 Dec 2017
I just saw this now. (It should have been in a Comment, not an Answer.)
That could be caused by very frequent (dense) grid spacing.
After that surf plot, add this line:
set(gca, 'EdgeColor','none')
If the grid spacing is the cause, that should be the solution.

Sign in to comment.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!