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?

1 次查看(过去 30 天)
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)')

采纳的回答

Walter Roberson
Walter Roberson 2016-10-16
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 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Assumptions 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by