필터 지우기
필터 지우기

How do you find average power?

조회 수: 138 (최근 30일)
Nathan Jaqua
Nathan Jaqua 2019년 11월 20일
댓글: Rik 2020년 5월 24일
Hi y'all, I'm having an issue with this logic. I need to find the average power of but I don't see what I am doing wrong with this. Nothing shows up when I read my start.au and thusly, I'm not sure about my voiced and un_voiced segments.
clc;
clear all;
[x, Fs] = audioread('start.au');
% plot the file
plot(x, Fs);grid on;
title('raw speech data');
xlabel('samples');ylabel('amplitude');
% identify voiced segment from the speech vector. Load it in newly created
% voiced segment array
L = 300; % number of samples in sub-sample array
x_voiced = x(L:0+ L-1);
% identify unvoiced segment from the speech vector. Load it in newly created
% unvoiced segment array
x_unvoiced = x(L:0 + L-1);
% calculate average power of a voiced and unvoiced segments.
% Use avg power formula as shown in the file
P_voiced = sum(x_voiced)/L;
P_unvoiced = sum(x_unvoiced)/L;
  댓글 수: 2
Rik
Rik 2019년 11월 20일
This time I edited your question for you. Next time, please use the tools explained on this page to make your question more readable.
As for why nothing is showing up: you are only plotting a single point. Use plot(x) or plot(1:numel(x),x) instead, and you should see a curve.
I don't really understand the rest of your code, so I'm not sure if this is already the solution you need.
Nathan Jaqua
Nathan Jaqua 2019년 11월 20일
I need to find the voiced and unvoiced portions of the signal. I thought that L:0 was what I needed in that part to find it, but I'm really not sure. Nor am I sure on how to find the average power based on the equation I attached to the question when I initially asked it.

댓글을 달려면 로그인하십시오.

채택된 답변

Daniel M
Daniel M 2019년 11월 21일
편집: Daniel M 2019년 11월 21일
Calculating the average power of your discrete signal according to the equation in your attached figure is done as:
P = sum(x.^2)/L;
Or
P = mean(x.^2);
Or
P = rms(x)^2;
  댓글 수: 2
Madonna Magdy
Madonna Magdy 2020년 5월 24일
excuse me , what's the unit of this average power ?
p= sum(x.^2)/L
Rik
Rik 2020년 5월 24일
That isn't really a Matlab question, but you can figure it out with unit analysis. Squaring and division affect the unit, but sum doesn't.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by