matlab fir1 bandpass
时间: 2023-08-11 17:05:18 浏览: 74
在MATLAB中,使用fir1函数可以设计一个带通滤波器。带通滤波器可以通过指定截止频率和滤波器阶数来创建。下面是一个使用fir1函数设计带通滤波器的示例代码:
```matlab
fs = 1000; % 采样率
f1 = 50; % 低频截止频率
f2 = 200; % 高频截止频率
n = 100; % 滤波器阶数
% 设计带通滤波器
b = fir1(n, \[f1, f2\]/(fs/2), 'bandpass');
% 对信号进行滤波
filtered_signal = filter(b, 1, original_signal);
% 绘制原始信号和滤波后的信号
subplot(2, 1, 1);
plot(t, original_signal);
title('Original Signal');
subplot(2, 1, 2);
plot(t, filtered_signal);
title('Bandpass Filtered Signal');
xlabel('Time (s)');
```
这段代码中,我们首先定义了采样率fs、低频截止频率f1、高频截止频率f2和滤波器阶数n。然后使用fir1函数设计了一个带通滤波器,将其系数保存在变量b中。最后,使用filter函数对原始信号进行滤波,得到滤波后的信号filtered_signal。通过subplot和plot函数,我们可以将原始信号和滤波后的信号绘制在同一张图上进行比较。
#### 引用[.reference_title]
- *1* *2* [MATLAB函数——fir1](https://blog.csdn.net/weixin_43870101/article/details/106961483)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [matlab设计FIR滤波器](https://blog.csdn.net/hou19975418/article/details/130581255)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
相关推荐
![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)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)