用matlab求 f(t)=[sin(pi*t)/pi*t]^2的傅里叶变换
时间: 2023-10-04 21:08:30 浏览: 227
可以使用MATLAB中的`fourier`函数来求解`f(t)`的傅里叶变换。具体实现步骤如下:
1. 定义时间范围和时间步长
可以选择一个合适的时间范围和时间步长,以便于计算傅里叶变换。
```matlab
t = -10:0.01:10; % 时间范围为-10到10,时间步长为0.01
```
2. 定义函数`f(t)`
```matlab
f = (sin(pi*t)./(pi*t)).^2;
```
3. 计算傅里叶变换
```matlab
F = fourier(f);
```
4. 绘制傅里叶变换的幅度谱和相位谱
```matlab
F_abs = abs(F);
F_phase = angle(F);
subplot(2,1,1);
plot(F_abs);
title('Amplitude spectrum');
xlabel('Frequency');
ylabel('Magnitude');
subplot(2,1,2);
plot(F_phase);
title('Phase spectrum');
xlabel('Frequency');
ylabel('Phase (rad)');
```
最终得到的结果如下图所示:
![傅里叶变换幅度谱和相位谱](https://img-blog.csdn.net/20180717193327361?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3JlZGVmaW5lX2Jsb2c=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/q/80)