⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fft_plot.mht

📁 it is a very essential matlab code.
💻 MHT
字号:
From: <Saved by Windows Internet Explorer 7>
Subject: 
Date: Tue, 12 May 2009 09:57:08 -0700
MIME-Version: 1.0
Content-Type: text/html;
	charset="Windows-1252"
Content-Transfer-Encoding: 7bit
Content-Location: http://www.mece.ualberta.ca/Courses/mec390/390code/fft_plot.m
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="MSHTML 6.00.6000.16825" name=GENERATOR></HEAD>
<BODY><PRE>%
% 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 - data vector
%         dt - spacing of signal in time domain
%
% output: plot of signal in time and frequency domain

% Fourier transform calculation

ffty = fft(y)/length(y)*2;  % perform FFT and scale
ffty(1) = ffty(1)/2;        % correct DC value

% time domain plot

subplot(2,1,1);

t = 0:dt:(length(y)-1)*dt;  % create time vector for plotting
plot(t,y);
xlabel('time (sec)');
ylabel('amplitude');
title('Time and Frequency Domain Representation of a Signal');

% for the FFT plot, only plot length(ffty)/2 + 1 points
% and scale x-axis as frequency...

subplot(2,1,2);

numfft = length(ffty)/2 + 1;
f = linspace(0,1/dt/2,numfft);   %                o
stem(f,abs(ffty(1:numfft)));     % 'stem' plot    | 
xlabel('frequency (Hz)');
ylabel('amplitude');

</PRE></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -