X(t) = t-2 for -2<=t<=0
= 2-t for 0<=t<=+2
= 0 otherwise
Find out the Energy and power of the signal. Also check whether the signal is energy signals and power signals
close all,
clear all,
clc,
Fs=100;
t = -2:(1/Fs):2;
Xt = [];
Energy = 0;
Power = 0;
for r=1:length(t)
Xt(r)=0;
if(t(r)>=-2 && t(r)<=0), Xt(r) = t(r)-2; end
if(t(r)>0 && t(r)<=2), Xt(r) = 2 - t(r); end
Energy = Energy + Xt(r)*Xt(r);
end
scrsz = get(0,'ScreenSize');
Dim=0;
figure('Position',[scrsz(1)+Dim, scrsz(2)+Dim,scrsz(3)-20,scrsz(4)-100]);
plot(t,Xt);
xlabel('--- Time (t) ---');
ylabel('--- X(t) --->');
title('X(t) for -2 < t < 2','FontSize',20);
grid on,
Power = Energy/length(Xt);
fprintf('\n\tEnergy = %.3f',Energy);
fprintf('\n\tPower = %.3f',Power);
Energy = 2141.340
Power = 5.340
Comments
Leave a comment