You are on page 1of 4

%Find and plot the signals and the energy of the following signals:

%x(t) = e-t/2 (u(t) - u(t-4)) sin(πt),


t = 0:0.01:8;
x = exp(-t/2) .* (heaviside(t) - heaviside(t-4)) .* sin(pi*t);
energy = trapz(t, x.^2);
disp(['Energy of the signal: ', num2str(energy)]);

Energy of the signal: 0.47872

figure;
plot(t, x);
xlabel('Time (t)');
ylabel('Signal x(t)');
title('BL.EN.U4ECE23238ECE23238');

1
%Find and plot the signals and the energy of the following signals:
%x(-t)
t = 0:0.01:8;
x = exp(-t/2) .* (heaviside(-t) - heaviside(-t+4)) .* sin(pi*(-t));
energy = trapz(-t, x.^2);
disp(['Energy of the signal: ', num2str(energy)]);

Energy of the signal: -0.47872

figure;
plot(-t, x);
xlabel('Time (t)');
ylabel('Signal x(-t)');
title('BL.EN.U4ECE23238');

1
%Find and plot the signals and the energy of the following signals:
% x(2t)
t = 0:0.01:8;
x = exp(-t) .* (heaviside(2*t) - heaviside(2*t-8)) .* sin(pi*2*t);
energy = trapz(2*t, x.^2);
disp(['Energy of the signal: ', num2str(energy)]);

Energy of the signal: 0.48748

figure;
plot(t, x);
xlabel('Time (t)');
ylabel('Signal x(2t)');
title('BL.EN.U4ECE23238');

1
%Find and plot the signals and the energy of the following signals:
%x(t/2)
t = 0:0.01:8;
x = exp(-t/4) .* (heaviside(t/2) - heaviside((t-8)/t)) .* sin(pi*t/2);
energy = trapz(t/2, x.^2);
disp(['Energy of the signal: ', num2str(energy)]);

Energy of the signal: 0.47872

figure;
plot(t, x);
xlabel('Time (t)');
ylabel('Signal x(t/2)');
title('BL.EN.U4ECE23238');

You might also like