How to set Spectrogram parameters

10 views (last 30 days)
Théo
Théo on 9 May 2023
Commented: Mathieu NOE on 11 May 2023
Hello Everyone,
I would like to print the spectrogram of a curve, in order to observe variations. But I don't really understand how to set the parameters of the function "spectrogram" even with the Matlab help.
For now I have this :
But I can't observe any variation. Is it possible to obtain something more like that :
There is my code and the attached file to get all the datas :
clear all;
clc ;
close all;
Valeurs = xlsread('C:\Users\tlam\Desktop\Run 80.xlsx',"Data1");
Temps = Valeurs(:,1);
Accelero = Valeurs(:,2);
Moteur_rpm = Valeurs(:,3);
BV_rpm = Valeurs(:,4);
Delta = Moteur_rpm - BV_rpm;
M_temps = max(Temps);
Moteur_Hz = Moteur_rpm * 0.016667;
BV_Hz = BV_rpm * 0.016667 ;
Delta_Hz = Delta * 0.016667;
%%
F = figure( 'Position', [50 50 1600 900]) ; % Visible 'off' pour ne pas afficher
t = tiledlayout(3,3,'TileSpacing','Compact','Padding','Compact');
title(t,"Spectro FULL ")
% Mot_rpm(t) et BV_rpm(t) Run 1
nexttile([1 2])
plot(Temps,Moteur_rpm,'red',Temps,BV_rpm,'green')
xlim ([0 M_temps])
ylabel('Moteur & BV [rpm]')
legend ('Moteur','Boite de Vitesse')
grid on
Fs = 50000; %Hz
% Spectrogramme Run 1
nexttile([2 1])
spectrogram(Accelero,100,99,100,Fs,'yaxis','power')
hold on
plot(Temps,Moteur_Hz,'r',Temps,BV_Hz,'g',Temps,Delta_Hz,'b')
colormap('jet')
% Delta(t) Run 1
nexttile([1 2])
plot(Temps,Delta,'blue')
xlim ([0 M_temps])
ylabel('Delta [rpm]')
grid on
% Accelero(t) Run 1
nexttile([1 2])
plot(Temps,Accelero,'magenta')
xlabel('temps [s]')
xlim ([0 M_temps])
ylabel('acceleromètre [V]')
grid on
  19 Comments
Théo
Théo on 11 May 2023
You helped me a lot thank you !

Sign in to comment.

Answers (0)

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!