From: SSK K on
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
From: Dave Robinson on
"SSK K" <kunnal.sandesh(a)gmail.com> wrote in message <huqtlp$867$1(a)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
From: Greg Heath on
On Jun 10, 10:43 am, "SSK K" <kunnal.sand...(a)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 data

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

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

Xb = fftshift(X); % Bipolar frequency version defined over
fb = f-df*ceil((N-1)/2); % fb = df*[-N/2 : N/2-1] for N even
% fb = 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