MATLAB Answers

energy of a signal in t and f domain

6 views (last 30 days)
Ray Lee
Ray Lee on 3 Dec 2014
Commented: Ray Lee on 5 Dec 2014
The energy of a signal is expected to be the same in t and f domain.
n = 1e4;
dx = 0.25;
x = rand(n,1) -0.5;
ex = sum(x.^2) *dx; % energy in t domain
y = fft(x);
fs = 1/dx;
df = fs/n;
ya = abs(y);
ey = sum(ya.^2) *df; % energy in f domain
but from the code, ey/ex=16, exactly the squared fs.
what's the problem?


Sign in to comment.

Accepted Answer

Ray Lee
Ray Lee on 5 Dec 2014
I found the solution myself.
Normalizing spectral amplitude by fs will work.
But I don't know why to do this.


Sign in to comment.

More Answers (1)

Star Strider
Star Strider on 3 Dec 2014
You need to normalise the fft by dividing it by the length of the signal:
y = fft(x)/length(x);
See the documentation for fft for details.


Ray Lee
Ray Lee on 4 Dec 2014
Before, I got ey/ex=16
after normalization, I got ey/ex=1.6000e-07
Ray Lee
Ray Lee on 5 Dec 2014
it seems y = fft(x) / fs

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by