• 大小: 0M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-18
  • 语言: 其他
  • 标签: 其他  

资源简介

gangqin.zip

资源截图

代码片段和文件信息

[gqfs]=audioread(‘piano.wav‘);                                            %读取音频文件
n=length(gq);                                                              %计算信号长度
gq1=fft(gqn);                                                             %对音频数据进行快速傅里叶变化     
len = round((length(gq1))/2);                                              %取一半数据

figure(1);                                                                 %建立一个画图界面
subplot(221);                                                            %该界面中图片为两行两列,这里画第一个
plot(gq);                                                                  %画出音频时域图像
title(‘初始信号波形‘);                                                      %设置标题
xlabel(‘时间‘);                                                             %设置X轴单位
ylabel(‘幅度‘);                                                             %设置Y轴单位
grid on                                                                    %添加网格线

subplot(222);                                                            %画第二个图
plot(abs(gq1(1:len)));                                                     %画出音频的频谱图
title(‘初始信号频谱‘);                                                      %设置标题
xlabel(‘频率‘);                                                             %设置X轴单位
ylabel(‘幅度‘);                                                             %设置Y轴单位
grid on                                                                    %添加网格线

load(‘E:\lowpass.mat‘);                                                     %导入滤波器
[ba]=tf(Hd);                                                              %得出传递系数

x=filter(bagq);                                                          %滤波器进行滤波
n=length(x);                                                               %计算滤波后音频数据长度
X1=fft(xn);                                                               %对滤波后音频进行傅里叶变化
len = round((length(X1))/2);                                               %选取一半长度

subplot(223);                                                            %画第三个图
plot(x);                                                                   %画出滤波后音频的时域图
title(‘滤波后信号的波形‘);                                                  %设置标题
xlabel(‘时间‘);                                                             %设置X轴单位
ylabel(‘幅度‘);                                                             %设置Y轴单位
grid on                                                                    %添加网格线

subplot(224);                                                            %画第四个图
plot(abs(X1(1:len)));                                                      %画出滤波后音频的频谱图
title(‘滤波后信号的频谱‘);                                                   %设置标题
xlabel(‘频率‘);                                                             %设置X轴
ylabel(‘幅度‘);                                                             %设置Y轴
grid on                                                                     %添加网格线

fvtool(Hd‘Analysis‘‘magestimate‘);      

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        3513  2020-05-19 12:10  gangqin.m

评论

共有 条评论