plotting mat file with different sampling frequencies.. COMMENTS PLEASE
조회 수: 6 (최근 30일)
이전 댓글 표시
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개)
Walter Roberson
2018년 6월 16일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!