compute the average power of a discrete-time signal

8 ビュー (過去 30 日間)
D7
D7 2019 年 10 月 24 日
回答済み: Dinesh Yadav 2019 年 10 月 29 日
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.

回答 (1 件)

Dinesh Yadav
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

カテゴリ

Help Center および File ExchangeAudio I/O and Waveform Generation についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by