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!