find power of signal

49 ビュー (過去 30 日間)
Daemian
Daemian 2014 年 12 月 23 日
編集済み: Image Analyst 2014 年 12 月 24 日
Hi, how do i find total power of signal from a wav file and display it on axes ? I currently only have this.
[myRecording,fs] = audioread('filename.wav',[1,2*8000]); %fs = sample rate
Nsamps = length(myRecording);
t = (1/fs)*(1:Nsamps); %Prepare time data for plot
%Do Fourier Transform
y_fft = abs(fft(myRecording)); %Retain Magnitude
y_fft = y_fft(1:Nsamps/2); %Discard Half of Points
f = fs*(0:Nsamps/2-1)/Nsamps; %Prepare freq data for plot
%Plot Sound File in Time Domain
plot(handles.normalLies,t, myRecording)
xlabel(handles.normalLies,'Time (s)')
ylabel(handles.normalLies,'Amplitude')
%Plot Sound File in Frequency Domain
plot(handles.fttLies,f, y_fft)
xlim(handles.fttLies,[0 20])
xlabel(handles.fttLies,'Frequency (Hz)')
ylabel(handles.fttLies,'Amplitude')

採用された回答

Shoaibur Rahman
Shoaibur Rahman 2014 年 12 月 24 日
In time domain: for discrete signal x(n)
Instantaneous power = x(n)^2
Average power = (1/N) * sum(x(n).^2)
N = data length or period

その他の回答 (1 件)

Image Analyst
Image Analyst 2014 年 12 月 24 日
編集済み: Image Analyst 2014 年 12 月 24 日
The total power would be a single number - a scalar. Do you mean power as a function of frequency, like the spectrum like you'd get from pwelch(), or fft()? From the help: "pxx = pwelch(x) returns the power spectral density (PSD) estimate, pxx, of the input signal, x, found using Welch's overlapped segment averaging estimator. " pwelch() is in the Signal Processing Toolbox. There is a webinar on spectral analysis that hopefully you can find on the Mathworks web site that goes over it and the fft in detail.

カテゴリ

Help Center および File ExchangeSpectral Measurements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by