compute the average power of a discrete-time signal

8 visualizaciones (últimos 30 días)
D7
D7 el 24 de Oct. de 2019
Respondida: Dinesh Yadav el 29 de Oct. de 2019
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.

Respuestas (1)

Dinesh Yadav
Dinesh Yadav el 29 de Oct. de 2019
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

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