Use the symbolic toolbox of Matlab to calculate the energy of the signals x(t) and f(t). Verify theoretically. How is the energy of these two signals related?

13 Ansichten (letzte 30 Tage)
I have two piecewise defined functions, x(t) and a reversed and shifted version of x(t) as shown below...I am supposed to use the symbolic toolbox in Matlab to calculate the energy of these two signals and explain how they are related. Not sure what the symbolic toolbox is...is it using syms function? Code for both signals is below.
% code
x = @(t) zeros(size(t)) +(t >= 0 & t < 2).*((1/2)*exp(t)) + (t >= 2 & t < 4).*(2*t-8);
t = linspace(0,6);
plot(t,x(t))
axis([-1 8 -4 4])
xlabel('Time(t)')
ylabel('x(t)')
title('Function x(t)')
% code
x = @(t) zeros(size(t)) +(t >= 0 & t < 2).*((1/2)*exp(t)) + (t >= 2 & t < 4).*(2*t-8);
f = @(t) x(-t-1);
t = linspace(-7, -1);
plot(t,f(t))
axis([-8 1 -4 4])
xlabel('Time(t)')
ylabel('f(t)');
title('Left shift and time reversal of x(t)')

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 16 Okt. 2016
That code I showed before,
syms x(t) shifted_x(t)
x(t) = evalin(symengine, 'piecewise([0 <= t and t < 2, exp(t)/2], [2 <= t and t < 4, 2*t-8], [t < 0 or t >= 4, 0])');
shifted_x(t) = x(-t-1);
is the Symbolic Toolbox implementation of a piecewise function. This is something that I would not expect very many people to know.
Possibly you are expected to implement in terms of heaviside functions and dirac delta
syms F(t)
F(t) = -exp(t)/2 * heaviside(-2 + t) + exp(t)/2 * heaviside(t) - (2 * t - 8) * heaviside(-4 + t) + (2 * t -8 ) * heaviside(-2 + t) + dirac(t)*(1/2) + dirac(t-2)*(-4)
The value of heaviside at the point where the parameter is 0 is something that can be adjusted with sympref() from R2015a onwards. The issue here is that heaviside(t) is 0 for t < 0 and is 1 for t > 0, but what is it at exactly t = 0 ? The dirac() is there to give explicit values at the boundary conditions
the energy of a signal F is var(F)
In turn, var(F(t)) is E(F(t)^2)-E(F(t))^2 where E standards for expected value. The expected value of F(t) is int(t*F(t), t, -inf, inf)
You can now put those formulas together with heaviside version of your piecewise functions to come up with a value for their energies. F(t) and F(-1-t) are the formula...
  7 Kommentare

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Paul
Paul am 10 Nov. 2024 um 15:46
syms x(t)
assume(t,'real');
x(t) = exp(t)/2*rectangularPulse(0,2,t) + (2*t - 8)*rectangularPulse(2,4,t)
Energy in real-valued x(t):
Ex = int(x(t)^2,t,-inf,inf)
disp(char(Ex))
exp(4)/8 + 253/24
x1(t) = x(-t-1);
Ex1 = int(x1(t)^2,t,-inf,inf)
disp(char(Ex1))
exp(4)/8 + 253/24

Community Treasure Hunt

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

Start Hunting!

Translated by