plotting mat file with different sampling frequencies.. COMMENTS PLEASE

3 visualizaciones (últimos 30 días)
JI Yong Song
JI Yong Song el 16 de Jun. de 2018
Comentada: Rena Berman el 21 de Jun. de 2018
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

Respuestas (1)

Walter Roberson
Walter Roberson el 16 de Jun. de 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?

Categorías

Más información sobre Audio I/O and Waveform Generation en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by