Effacer les filtres
Effacer les filtres

Sir i tried to plot a spectrogram for an audio . it showing error.

2 vues (au cours des 30 derniers jours)
Suchithra K S
Suchithra K S le 27 Nov 2018
Commenté : Vaishnavi le 31 Oct 2023
This is my code:
function outputSpectrogram(input)
[audio, fs] = audioread('asianelephantspeaker.wav');
audioMono = (audio(:, 1) + audio(:, 2)) / 2;
spectrogram(audio, 256, [], 25, 2000, 'yaxis');
title('rumble')
end
The error is like this "outputspectrogram
Error using spectrogram>chkinput (line 252)
X must be a vector (either row or column).
Error in spectrogram (line 166)
chkinput(x);
Error in outputspectrogram (line 5)
spectrogram(audio, 256, [], 25, 2000, 'yaxis');
>> "
How i will rectify this error?
and I will also attach my audio with this.

Réponses (1)

Jan
Jan le 27 Nov 2018
Modifié(e) : Jan le 27 Nov 2018
[audio, fs] = audioread('asianelephantspeaker.wav');
audioMono = (audio(:, 1) + audio(:, 2)) / 2;
spectrogram(audioMono, 256, [], 25, 2000, 'yaxis');
% ^^^^ the "Mono" was missing
  2 commentaires
Suchithra K S
Suchithra K S le 28 Nov 2018
ok thank you sir.
Vaishnavi
Vaishnavi le 31 Oct 2023
That was really helpful. Thank you so much!!!!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Time-Frequency Analysis 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!

Translated by