Hi everyone, Can anybody help me by sending a MATLAB code for extracting frequency domain data from the time domain data (5000 points) present in .txt format.

1 view (last 30 days)
Hi, I have an a time domain data present in .txt format,I want to extract the frequency domain from that and want to plot a graph. Can somebody help in this by sending a codes.I will attach a time domain file. Please help me out in this matter.Waiting for valuable reply.

Answers (2)

Walter Roberson
Walter Roberson on 30 Dec 2015
fid = fopen('YourTextFile.txt', 'rt');
datacell = textscan(fid, '%f');
fclose(fid);
time_domain_data = datacell{1}(:);
frequency_domain_data = fft(time_domain_data);

Image Analyst
Image Analyst on 30 Dec 2015
Other than fft(), you might also look at related functions like periodogram(), pwelch(), psd(), and spectrogram() if you have the Signal Processing Toolbox. Go here for a complete discussion with plenty of examples: http://www.mathworks.com/help/signal/spectral-analysis.html

Community Treasure Hunt

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

Start Hunting!