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?
12 次查看(过去 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)')
0 个评论
采纳的回答
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.
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...
更多回答(1 个)
Paul
2024-11-10,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))
x1(t) = x(-t-1);
Ex1 = int(x1(t)^2,t,-inf,inf)
disp(char(Ex1))
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Assumptions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!