how to compute average power of the generated sinusoidal signal?

26 views (last 30 days)
lim1 = 0;
lim2 = 2*pi;
t = lim1:0.01:lim2;
A = 1.5;
f = 0.1;
omega= 2*pi*f;
phase= 0;
x = A*cos(omega*t+phase);
plot(t,x);
the following is my signal graph ? hohw should i compute the average power of the signal? how do i write out the formula?? for the average power signal
Px= limN→∞(1/2N+1) ∑|x(n)|^2

Answers (2)

Abraham Boayue
Abraham Boayue on 5 Apr 2018
Try this code, just an extension of your code.
clear variables
close all;
lim1 = -10;% no need to have t in pi
% units since omega is
% already measured in pi.
lim2 = 10;
M = 500; % length of
delta = (lim2-lim1)/(M-1);
t = lim1:delta:lim2;
A = 1.5;
f = 0.1;
omega= 2*pi*f;
phase= 0;
x = A*cos(omega*t+phase);
N = 10; % let say you want to average
% 10 terms of x
px = zeros(1,M);
for n = 1:N
px = px + (abs(A*cos(n*omega*t+phase))).^2;
end
px = (1/(2*N+1))*px;
%disp(px)
figure
plot(t,x,'linewidth',2);
hold on
plot(t,px,'linewidth',2)
a = ylabel('Signal');
set(a,'Fontsize',14);
a = xlabel('x');
set(a,'Fontsize',14);
a=title('x(t) and its average px');
legend('x(t)','px')
set(a,'Fontsize',16);
grid;
  1 Comment
Snow sin
Snow sin on 6 Apr 2018
Hi, thanks for the code, i tried it and have some question... Why your px values have 2 answer? shouldn't the average power value is a single value??

Sign in to comment.


Abraham Boayue
Abraham Boayue on 6 Apr 2018
Are you saying that px = 1/(2×N+1)[(Acos(wt))^2 + (Acos (2wt))^2 +... (Acos(N*wt))^2] should equal a single number? How possible is that? No way! According to the formula that you provided, you are simply summing a series of cosine squares and then dividing the result by 1/(2*N+1). You are actually performing an ensamble averaging on a time varying function and the result show be a time varying function. If you choose N large enough, you should end up with a delta function, a single value function that occurs at the peak of the cosine wave.

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!