I have a time domain signal.I want to calculate energy of my signal......

83 views (last 30 days)
Suppose my signal is X(t) then I want to get Fourier Transform >>> X(f) and then I want to calculate energy of my signal...
Can anyone help me? Thank you so much

Accepted Answer

SK
SK on 18 Oct 2014
Edited: SK on 18 Oct 2014
Use the fft() function to calculate fourier transform. Then take the of squares of the coefficients:
F = fft(X);
pow = F.*conj(F);
This gives the power at each frequency. You can sum it (using the sum() fumction) to get the total power.
  4 Comments
vahid torabi
vahid torabi on 20 Oct 2014
I've attached my signal for you sir.Please place that in workspace in your matlab program. I want to calculate its energy in frequency domain. How much is its energy if you want to calculate that??? Let me know your result sir. Thank you very much sir.
Sukshith Shetty
Sukshith Shetty on 24 Sep 2021
How to calculate power of this signal?
Do I need to use fft ?
or any other approach?

Sign in to comment.

More Answers (3)

SK
SK on 20 Oct 2014
Your time values are more or less uniformly spaced with some slight variation but that shouldn't matter. Just type in the exact same code as above. I get as my answer:
total_pow =
4.7414e+03
  4 Comments
vahid torabi
vahid torabi on 22 Oct 2014
You're right sir.plz have a look at my file again. I can't write formula in here,So I have to attach pdf file. Thank you very much sir.
Sukshith Shetty
Sukshith Shetty on 24 Sep 2021
How to calculate power of this signal?
Do I need to use fft ?
Should I use any other approach ?

Sign in to comment.


SK
SK on 22 Oct 2014
Edited: SK on 22 Oct 2014
I'm not sure what your question is, but if you want to understand how it works, you will have to study the "Discrete Time Fourier Trasform" (DTFT) and "Discrete Fourier Transform" (DFT). This is the discrete time, discrete frequency version of the continuous Fourier transform. "Fast Fourier Transfrom" (FFT) is a fast algorithm to compute the DFT. You can easily find many tutorials online on these topics.
Mathematically there is an elegant theory for Fourier transforms and if you are an engineer it will be worth it to invest the time to know the theory. The equivalence of the variance and the sum of squares of the fourier coefficients comes from there and is known as Parseval's theorem. Another way to say it is that the fourier transform maps the space of square summable sequences (square integrable functions in the continuous case) onto the same space and preserves distance in that space (this is called isometry).
The naive implementation of dft is simple. fft is more involved so this is not the place to describe it, but you can find the implementation in some textbooks. A good textbook is "Linear Algebra and its applications" by Gilbert Strang.
  3 Comments
Nidhi Singh
Nidhi Singh on 9 Jan 2022
What is the unit of power when I calculate it from fft of the signal ? Is it in dB? After using the same code above I got the answer of total power in complex numbers. eg. Total_power = 1.30e02 + 1.77e-14i Can I use absolute value of that total power ? Or I don't know the use of conj here.. please explain.

Sign in to comment.


Paul
Paul on 24 Feb 2023
Edited: Paul on 25 Feb 2023
Suppose we have a continuous-time signal
syms t f
x(t) = exp(-abs(t/5))*sin(2*sym(pi)*2*t)
x(t) = 
This signal is noncausal and has infinite duration, i.e., has non-zero values over the entire time axis -inf < t < inf.
The general expression for energy of a continuous-time signal is
Ec = int(x(t)*conj(x(t)),t,-inf,inf)
Ec = 
Because x(t) is real, it can also be written as
Ec = int(x(t)^2,t,-inf,inf)
Ec = 
Because Ec is finite, x(t) is an energy signal.
The continuous-time Fourier (fourier) transform (CTFT) of x(t) is (f in Hz)
X(f) = simplify(fourier(x(t),t,2*sym(pi)*f))
X(f) = 
Note that X(f) is complex. By Parseval's theorem, the energy in x(t) can also be computed from X(f)
Ec = int(X(f)*conj(X(f)),f,-inf,inf)
Ec = 
For later use, express Ec as decimal number.
vpa(Ec)
ans = 
2.4993669029675871002446871947037
Suppose we sample x(t) to form a discrete-time signal x[n] = x(n*Ts). We know that x(t) contains a frequency of 2 Hz, so selecting a sampling frequency five times higher will probably be sufficient for x[n] to represent x(t). Specify the sampling frequency and compute the sampling period.
Fs = 10;
Ts = 1/Fs;
Define the discrete-time signal x[n]
syms n integer
x(n) = x(n*Ts);
The energy in a discrete-time signal is defined as the sum of the squares of the magnitudes x[n]
symsum(x(n)*conj(x(n)),n,-inf,inf)
ans = 
Matlab can't find a closed form solution. Maybe it could with some more manipuation.
Because x[n] is of infinite duration, the only way to compute its energy in the frequency domain is through the Discrete Time Fourier Transform (DTFT). Unfortunately, Matlab doesn't offer any means to find the DTFT of an infinite-duration, noncausal, discrete-time signal like it can find the CTFT of an infinite-duration, noncausal, continuous-time signal. However, Matlab can find the bilateral z-transform, from which we can determine the DTFT. Unfortunately, ztrans is limited to causal signals, which x[n] is not. However, we can still use the z-transform rules to find X(z).
Define the discrete-time unit step
u(n) = heaviside(n) + kroneckerDelta(n)/2;
The causal portion of x[n] is
xcausal(n) = subs(x(n),abs(n),n)*u(n)
xcausal(n) = 
Its z-transform is
syms z
Xcausal(z) = simplify(ztrans(xcausal(n),n,z))
Xcausal(z) = 
The noncausal portion of x[n] is
xnoncausal(n) = subs(x(n),abs(n),-n)*u(-n-1);
As defined, x[n] = xcausal[n] + xnoncausal[n]
Its z-transform is
Xnoncausal(z) = simplify(subs(simplify(ztrans(xnoncausal(-n),n,z)),z,1/z))
Xnoncausal(z) = 
Therefore, the bilateral z-ztransform of x[n] is
X(z) = simplify(Xcausal(z)+Xnoncausal(z));
Because we know that x[n] is an energy signal, the unit circle lies within the region-of-convergence of X(z) (we could show that explicitly). Therefore, the DTFT is X(z) evaluated on the unit circle
X(f) = simplify(X(exp(1j*2*sym(pi)*f)));
f has units of cycles, or cycles per sample. X(f) is periodic with period F = 1.
The energy in a discrete-time signal is determined from its DTFT by integrating the DTFT magnitude squared over one period.
int(simplify(X(f)*conj(X(f)),100),f,-1/2,1/2)
ans = 
Matlab is not finding a closed form solution.
Evaluate the integral numerically
Ed = vpaintegral(simplify(X(f)*conj(X(f)),100),f,-1/2,1/2)
Ed = 
24.9923
Multiplying Ed by by the sampling period, Ts, would be a very good approximation to Ec, the energy in the underlying continuous-time signal.
Even though x[n] is infinite-duration, it can be approximated with a finite-duration signal by assuming that x[n] is zero for large abs(n) because the envelope of x(n) is decreasing exponentially. For example, check n = 500, corresponding to t = n*Ts = 50 (actually, x(500) == 0, so let's check x(501))
vpa(x(501))
ans = 
0.000042322919355135445961834048486515
Small enough. Get the values of x[n] over the interval
nval = -500:500;
xval = double(x(nval));
Again, the energy is the sum of squares of the magnitudes, which is easily computed for a finite-duration signal
format long
Ed = sum(xval.*conj(xval))
Ed =
24.992279405373470
So that's a very good approximation to the energy in the entire signal as computed from the DTFT.
Because xval is finite-duration, we can, theoretically, get the exact same result (not perfectly exact due to rounding errors) from the Discrete Fourier Transform (DFT) samples computed from fft
XDFT = fft(xval);
Ed = sum(XDFT.*conj(XDFT))/numel(XDFT)
Ed =
24.992279405373484
Summary:
For a continuous-time signal the energy is computed by integrating the squared magnitude of the signal or its CTFT.
For a discrete-time signal the energy is computed by summing the squared magnitude of the signal or integrating the squared magnitude of its DTFT over one period.
For a discrete-time, finite duration signal, the energy can be computed by summing the squared magnitude of the DFT and dividing by the length of the signal.
The relationship between the energy in a continuous-time signal and the energy in the discrete-time signal formed by sampling it is: Ec = Ed*Ts.
Note: the CTFT and DTFT in this example used frequency in Hz (cycles/sec and cycles/sample). Could have used rad/sec and rad/sample, in which case we'd have some factors of 1/(2*pi) floating around (and the integral of abs(DTFT)^2 would be taken over different limits).

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!