{"id":566,"date":"2017-09-14T13:39:14","date_gmt":"2017-09-14T16:39:14","guid":{"rendered":"http:\/\/www.professores.uff.br\/diomarcesarlobao\/?page_id=566"},"modified":"2017-09-14T13:39:14","modified_gmt":"2017-09-14T16:39:14","slug":"fft_plot-m","status":"publish","type":"page","link":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/fft_plot-m\/","title":{"rendered":"fft_plot.m"},"content":{"rendered":"<pre>%\r\n% function file to perform a Fast Fourier Transform\r\n% of a data vector and plot both the time and frequency domain trace\r\n%\r\nfunction fftplot = fft_plot(y,dt)\r\n%\r\n% input:   y - data vector\r\n%         dt - spacing of signal in time domain\r\n%\r\n% output: plot of signal in time and frequency domain\r\n\r\n% Fourier transform calculation\r\n\r\nffty = fft(y)\/length(y)*2;  % perform FFT and scale\r\nffty(1) = ffty(1)\/2;        % correct DC value\r\n\r\n% time domain plot\r\n\r\nsubplot(2,1,1);\r\n\r\nt = 0:dt:(length(y)-1)*dt;  % create time vector for plotting\r\nplot(t,y);\r\nxlabel('time (sec)');\r\nylabel('amplitude');\r\ntitle('Time and Frequency Domain Representation of a Signal');\r\n\r\n% for the FFT plot, only plot length(ffty)\/2 + 1 points\r\n% and scale x-axis as frequency...\r\n\r\nsubplot(2,1,2);\r\n\r\nnumfft = length(ffty)\/2 + 1;\r\nf = linspace(0,1\/dt\/2,numfft);   %                o\r\nstem(f,abs(ffty(1:numfft)));     % 'stem' plot    | \r\nxlabel('frequency (Hz)');\r\nylabel('amplitude');\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>% % function file to perform a Fast Fourier Transform % of a data vector and plot both the time and frequency domain trace % function fftplot = fft_plot(y,dt) % % input: y &#8211; data vector % dt &#8211; spacing of signal in time domain % % output: plot of signal in time and frequency [&hellip;]<\/p>\n","protected":false},"author":22,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[],"tags":[],"class_list":["post-566","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/566","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/comments?post=566"}],"version-history":[{"count":1,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/566\/revisions"}],"predecessor-version":[{"id":567,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/566\/revisions\/567"}],"wp:attachment":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/media?parent=566"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/categories?post=566"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/tags?post=566"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}