COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### converting Time domain data to frequency data.

• Email
• Follow

```I have time domain data of a signal. I want to see how does the frequency domain curve look like..so how to convert the time domain data to freq data
```
 0

See related articles to this posting

```"SSK K" <kunnal.sandesh@gmail.com> wrote in message <huqtlp\$867\$1@fred.mathworks.com>...
> I have time domain data of a signal. I want to see how does the frequency domain curve look like..so how to convert the time domain data to freq data

help fft maybe

Dave Robinson
```
 0

```On Jun 10, 10:43=A0am, "SSK K" <kunnal.sand...@gmail.com> wrote:
> I have time domain data of a signal. I want to see how does the frequency=
domain curve look like..so how to convert the time domain data to freq dat=
a

help fft

For N equispaced points of x sampled at Fs Hz
(Square brackets indicate continuous time and frequency functions.
Round brackets indicate discrete time and frequency functions):

dt =3D 1/Fs         % Time sample spacing
t =3D dt*(0:N-1);  % Sampling times t(n) =3D dt*(n-1), n =3D 1:N.
x(1:N);             % Sampled function values x(n) =3D x[t =3D t(n)]
T =3D N*dt          % Period of periodic reconstruction xr =3D
ifft(fft(x))
% i.e., xr(n+N) =3D xr(n) corresponding to xr[t
+T] =3D xr[t]

X =3D fft(x);         % Discrete Fourier Transform of x
df =3D Fs/N         % Frequency sample spacing (df =3D 1/T)
f =3D df*(0:N-1);  % Sampled frequencies f(n) =3D df*(n-1), n =3D 1:N.
X(1:N);            % Transform function values X(n) =3D X[f =3D f(n)]
Fs =3D N*dt        % Transform period (i.e., X[f+Fs] =3D X(f);
% corresponding to X(n+N) =3D X(n);

Xb =3D fftshift(X); % Bipolar frequency version defined over
fb =3D f-df*ceil((N-1)/2); % fb =3D df*[-N/2 : N/2-1] for N even
% fb =3D df*[-(N-1)/2 : (N-1)/2] for
N odd
figure(1)
plot(t,x);

figure(2)
subplot(221)
plot(fb,real(Xb))
subplot(222)
plot(fb,imag(Xb))
subplot(223)
plot(fb,abs(Xb))
subplot(224)
plot(fb,angle(Xb))

Hope this helps.

Greg
```
 1