plotting mat file with different sampling frequencies.. COMMENTS PLEASE
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I'm given this g(t) sound signal. I'm supposed to sample this signal with sampling frequencies 8KHz and 4KHz, then plot these two sampled signals. I tried until doing the sampling part, but don't know how to plot it..I googled this but got no useful information. The g(t) signal is given as g1.mat and it's a 48000*1 double struct.
%%Sampling
x1 = load('g1.mat');
f = fieldnames(x1);
sound(x1.(f{1}),8000);
I got until here but can't proceed..Can anyone help me plot the g(t) signal sampled at 8KHz, 4Khz on the frequency domain? By the way, if i change sound(x1.(f{1}),8000); this part to 4000, the duration of the sound is different. I was asked to make the duration same. How can i modify this too?
Thanks
1 commentaire
Réponses (1)
Walter Roberson
le 16 Juin 2018
t = (0:length(x1.f1)-1)/8000;
plot(t, x1.f1)
To make the duration the same, you need to resample. There are several ways to do that. Perhaps some particular resampling techniques have been discussed in class?
0 commentaires
Voir également
Catégories
En savoir plus sur Audio I/O and Waveform Generation dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!