compute the average power of a discrete-time signal
조회 수: 6 (최근 30일)
이전 댓글 표시
Record and plot \Hello world" using Matlab.
(a) Write a Matlab script that records yourself saying \Hello world" using the Matlab audiorecorder
object. Set the sampling rate to 8000 samples/sec and resolution to 16 bits. Include your script
as your answer to this item. This part was done no problem but I need help with part C
(c) On the same axes, plot the average power of your speech over a 20 msec window. You must sweep
this window over the entire duration of the signal and obtain a continuous/discrete plot of the
average power over 20 msec intervals. Include your script for calculating average power along
with your updated plot as your answer to this item. Hints: Use Matlab's hold command to plot
multiple signals on the same axes. You are asked to compute the average power of a discrete-time
signal, so you will be squaring and summing the samples contained in the signal array passed back
by the audiorecorder object. Use a loop to control the computation (average power over 20 msec)
over the entire signal. See if you can avoid a loop over each 20 msec chunk by using Matlabs colon
notation to index into the signal array.
댓글 수: 0
답변 (1개)
Dinesh Yadav
2019년 10월 29일
Hi, what you can try is first find the length of your audio samples file. Which would be samplingRate*timeLength of signal.
Now divide it into 20msec intervals i.e. in this case a window of 40 samples(2000*20*10^-3) using reshape function in MATLAB. Lets say signal length is x samples. No of columns in new matrix will be
cols = floor(x/40)
newMat = reshape(oldArr,[40,cols]);
Now just compute power per column.
for i=1:cols
pow[i]=sum(newMat(:,i).^2);
end
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Audio and Video Data에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!