Discrete values in DFT

2 views (last 30 days)
sahil sharma
sahil sharma on 21 Jun 2022
Edited: Paul on 21 Jun 2022
Hi,
I have just started learning DFT, so my question is a very basic one.
While defining the sampling frequency of any signal, its value can go either in decimal or discrete positive values. The same goes for the sampling time.
In many examples present online, the sampling time is mentioned in this format:
Tn=0:0.01:100;
So, my question is, according to the definition of the DFT the values independent as well as the dependent variables need to be a discrete number. But here we are taking the samples in non-discrete values. Can someone please explain this to me?

Accepted Answer

Paul
Paul on 21 Jun 2022
Edited: Paul on 21 Jun 2022
Hi Sahil,
In general:
Let x(t) be a continuous-time signal, i.e., where the inedpendent variable, t, is any real number with -inf < t < inf
Let x[n] be a discrete time signal, i.e., where the independent variable, n, is an integer with -inf < n < inf
Note x(t) and x(n) can take on any finte values, either real or complex. And x(t) can also include Dirac delta "functions" (don't worry about that if not famiiar). There is no requirement that x[n] (the "dependent variable") take on only discrete values.
Let x[n] be formed by samping x(t) with a sampling period, Ts.
Then x[n] = x(n*Ts) and we have the basic relationship
t_n = n*Ts, or n = t_n/Ts.
So, for the example in the question we have:
Tn = 0:.01:100;
where Tn = n*Ts and are a finite number of times that the continuous-time signal is sampled. Therefore
Ts = 0.01;
and the values of the discrete-time independent variable that correspond to those sample times are, in theory
n = Tn/Ts;
But it's better to compute n by
n = round(Tn/Ts);
to ensure integer values, or just simply
n = 0:(numel(Tn)-1);
Your question is about DFT. For the DFT, it is assumed that x[n] = 0 for n < 0 and x[n] = 0 for n > N. In this case, we assume that x[n] = 0 for n > n(end).
Note that, in the general case, if the vector of sample times does not start at 0, we need to do a little more work. For example
Tn = -1:.01:100;
We still have
Ts = 0.01;
And the corresponding values of n would be
n = (0:(numel(Tn)-1)) + round(Tn(1)/Ts);
or I suppose
n = round(Tn/Ts);

More Answers (0)

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!