Calculating energy of a signal using symbolic toolbox

1 view (last 30 days)
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)')

Accepted Answer

Gautam Mohan
Gautam Mohan on 18 Oct 2016
Hi Aaron,
The syms() function is indeed part of the Symbolic Toolbox. From my understanding, finding the energy of a signal involves taking the integral of its magnitude:
https://en.wikipedia.org/wiki/Energy_(signal_processing)
If you are supposed to use the symbolic function, I would suggest defining each function using piecewise() and then taking the integral of each after computing the magnitude -- both functions are available as part of the Symbolic Toolbox. Here are some links below to get started:
https://www.mathworks.com/help/symbolic/piecewise.html
https://www.mathworks.com/help/symbolic/int.html
Hope this helps!

More Answers (0)

Community Treasure Hunt

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

Start Hunting!