门函数的傅里叶变换的 MATLAB 代码 作者:AiWJ 地址
时间: 2024-05-25 15:17:17 浏览: 4
function [F, freq] = rectFT(t, rect)
%RECTFT calculates the Fourier Transform of a rectangular function
% [F, freq] = rectFT(t, rect) returns the Fourier Transform of a rectangluar function
% defined by rect over the time interval t.
% rect is a vector of the same length as t, containing only 1's and 0's.
% F is the Fourier Transform of rect, and freq is the corresponding frequency vector.
dt = t(2) - t(1); % time step
N = length(t); % number of time points
df = 1 / (N * dt); % frequency step
tshift = (t - t(1)) - (t(end) - t(1))/2; % shift the time axis to center the function
fshift = fftshift(rect); % shift the function to center the frequency axis
F = df * fft(fshift); % Fourier Transform
freq = -1/(2*dt):df:1/(2*dt)-df; % frequency vector
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)