[voice,fs]=audioread('ding.wav');
sound(voice,fs); %声音回放
figure(1);
[voice,fs]=audioread('ding.wav');
plot(voice); %绘出时域波
xlabel('t'); ylabel('A'); %坐标名称
title(' 初始音频信号时域波形 ','FontName','宋体');
grid on;
figure(2);
[voice,fs]=audioread('ding.wav');
n=length(voice); %计算长度
voice1=fft(voice,n);%快速傅里叶变换
plot(abs(voice1)); %绘出原始音频信号频谱
title(' 初始音频信号频域波形 ','FontName','宋体');
xlabel('f'); ylabel('A');
grid on;
[signal,fs] = audioread('ding.wav' );
len_signal = length( signal ); %信号的长度
T = 1/fs; %采样周期
t = T:T:len_signal/fs; %时间t序列
fft_N = 2^nextpow2( len_signal ); %计算fft变换的点数
SIGNAL = fft( signal,fft_N ); %快速傅里叶变换
SIGNAL_AMP = abs( SIGNAL ); %只做幅频分析,对fft变换后序列取模
SIGNAL_AMP_HALF = SIGNAL_AMP(1:(fft_N/2));%由于对称性,只取前一半
[SIGNAL_pks,locs] = findpeaks( SIGNAL_AMP_HALF ); %寻找频谱峰值点
sort_pks = sort( SIGNAL_pks,'descend' ); %对频谱峰值点进行排序
sort_loc = find( SIGNAL_pks>=sort_pks(2) ); %找到峰值最大的2个点排序后在pks中的位置
n1 = locs( sort_loc(1) ); %最高峰值点在序列中的位置
n2 = locs( sort_loc(2) ); %第二高峰值点在序列中的位置
Y1 = SIGNAL_AMP_HALF(n1); %最高峰值点在频谱中的幅度
Y2 = SIGNAL_AMP_HALF(n2); %第二高峰值点在频谱中的幅度
f1 = (n1-1)*fs/fft_N %最高峰值点频率
y1 = (Y1/(Y1+Y2))*cos(2*pi*f1*t); %第一个频率信号
figure(9);
plot( t,y1 ); %绘制原信号时域波形
axis( [T len_signal*T -0.08 0.08] ); %限定显示范围
title( '分解信号时域波形图1' ,'FontName','宋体'); %绘制标题
xlabel('时间(s)','FontName','宋体'); ylabel('幅值','FontName','宋体');
[signal,fs] = audioread('ding.wav' );
len_signal = length( signal ); %信号的长度
T = 1/fs; %采样周期
t = T:T:len_signal/fs; %时间t序列
fft_N = 2^nextpow2( len_signal ); %计算fft变换的点数
SIGNAL = fft( signal,fft_N ); %快速傅里叶变换
SIGNAL_AMP = abs( SIGNAL ); %只做幅频分析,对fft变换后序列取模
SIGNAL_AMP_HALF = SIGNAL_AMP(1:(fft_N/2));%由于对称性,只取前一半
[SIGNAL_pks,locs] = findpeaks( SIGNAL_AMP_HALF ); %寻找频谱峰值点
sort_pks = sort( SIGNAL_pks,'descend' ); %对频谱峰值点进行排序
sort_loc = find( SIGNAL_pks>=sort_pks(2) ); %找到峰值最大的2个点排序后在pks中的位置
n1 = locs( sort_loc(1) ); %最高峰值点在序列中的位置
n2 = locs( sort_loc(2) ); %第二高峰值点在序列中的位置
Y1 = SIGNAL_AMP_HALF(n1); %最高峰值点在频谱中的幅度
Y2 = SIGNAL_AMP_HALF(n2); %第二高峰值点在频谱中的幅度
f1 = (n1-1)*fs/fft_N; %最高峰值点频率
f2 = (n2-1)*fs/fft_N %第二高峰值点频率
y2 = (Y2/(Y1+Y2))*cos(2*pi*f2*t); %第二个频率信号
figure(8)
plot( t,y2 ); %绘制原信号时域波形
axis( [T len_signal*T -0.08 0.08] ); %限定显示范围
title( '分解信号时域波形图2' ,'FontName','宋体'); %绘制标题
xlabel('时间(s)','FontName','宋体'); ylabel('幅值','FontName','宋体');
[signal,fs] = audioread('ding.wav' );
len_signal = length( signal ); %信号的长度
T = 1/fs; %采样周期
t = T:T:len_signal/fs; %时间t序列
fft_N = 2^nextpow2( len_signal ); %计算fft变换的点数
SIGNAL = fft( signal,fft_N ); %快速傅里叶变换
SIGNAL_AMP = abs( SIGNAL ); %只做幅频分析,对fft变换后序列取模
SIGNAL_AMP_HALF = SIGNAL_AMP(1:(fft_N/2));%由于对称性,只取前一半
[SIGNAL_pks,locs] = findpeaks( SIGNAL_AMP_HALF ); %寻找频谱峰值点
sort_pks = sort( SIGNAL_pks,'descend' ); %对频谱峰值点进行排序
sort_loc = find( SIGNAL_pks>=sort_pks(2) ); %找到峰值最大的2个点排序后在pks中的位置
n1 = locs( sort_loc(1) ); %最高峰值点在序列中的位置
n2 = locs( sort_loc(2) ); %第二高峰值点在序列中的位置
Y1 = SIGNAL_AMP_HALF(n1); %最高峰值点在频谱中的幅度
Y2 = SIGNAL_AMP_HALF(n2); %第二高峰值点在频谱中的幅度
f1 = (n1-1)*fs/fft_N; %最高峰值点频率
f2 = (n2-1)*fs/fft_N; %第二高峰值点频率
y1 = (Y1/(Y1+Y2))*cos(2*pi*f1*t); %第一个频率信号
y2 = (Y2/(Y1+Y2))*cos(2*pi*f2*t); %第二个频率信号
A = max( signal ); %原信号的最大幅度
hecheng = (y1+y2)/max( y1+y2 ); %合成信号归一化
sound( hecheng,fs ); %合成音频信号播放
[voice,fs]=audioread('ding.wav');
n=length(voice); %计算长度
t=0:1/fs:(n-1)/fs;
noise=0.03*sin(2*pi*100000*t'); %100kHz 正弦波噪声
s=voice+noise; %加噪后的音频信号
sound(s,fs); %播放加噪的语音
[voice,fs]=audioread('ding.wav');
n=length(voice); %计算长度
t=0:1/fs:(n-1)/fs;
noise=0.03*sin(2*pi*100000*t'); %100kHz 正弦波噪声
s=voice+noise; %加噪后的音频信号
figure(3);
n=length(s); %计算长度
voice1=fft(s,n);%快速傅里叶变换
plot(abs(voice1)); %绘出原始音频信号频谱
title(' 加噪音频信号频域波形 ','FontName','宋体');
xlabel('f'); ylabel('A');
grid on;
figure(6);
plot(s); %绘出原始音频信号频谱
title(' 加噪音频信号时域波形 ','FontName','宋体');
xlabel('f'); ylabel('A');
grid on;
[voice,fs]=audioread('ding.wav');
n=length(voice); %计算长度
t=0:1/fs:(n-1)/fs;
noise=0.03*sin(2*pi*100000*t'); %100kHz 正弦波噪声
s=voice+noise; %加噪后的音频信号
rp=0.1; %通带最大衰减
rs=60; %阻带最小衰减
Ft=1000;
Fp=60; %通带截止频率fp
Fs=100; %阻带截止频率fs
wp=2*pi*Fp/Ft;%WP是通带截止频率
ws=2*pi*Fs/Ft; %WS是阻带截止频率
[n,wn]=ellipord(wp,ws,rp,rs,'s');% 调用 ellipod 计算椭圆 DF阶数 N和通带截止频率 wp,
[bz,az]=ellip(n,rp,rs,wn);% 调用 ellip 计算椭圆带通 DF系统函数系数向量B和 A
[h,w]=freqz(bz,az);
figure(4);
plot(w*fs/(2*pi),abs(h)); %绘制 IIR 低通滤波器特性曲线
title('IIR 低通滤波器特性曲线 ','FontName','宋体');
grid on;
xlabel('f/Hz');ylabel(' 幅度')
[voice,fs]=audioread('ding.wav');
n=length(voice); %计算长度
t=0:1/fs:(n-1)/fs;
noise=0.03*sin(2*pi*100000*t'); %100kHz 正弦波噪声
s=voice+noise; %加噪后的音频信号
rp=0.1; %通带最大衰减
rs=60; %阻带最小衰减
Ft=1000;
Fp=60; %通带截止频率fp
Fs=100; %阻带截止频率fs
wp=2*pi*Fp/Ft;%WP是通带截止频率
ws=2*pi*Fs/Ft; %WS是阻带截止频率
[n,wn]=ellipord(wp,ws,rp,rs,'s');% 调用 ellipod 计算椭圆 DF阶数 N和通带截止频率 wp,
[bz,az]=ellip(n,rp,rs,wn);% 调用 ellip 计算椭圆带通 DF系统函数系数向量B和 A
[h,w]=freqz(bz,az);
z=filter(bz,az,s); %滤波
sound(z,fs); %播放加噪的语音
[voice,fs]=audioread('ding.wav');
n=length(voice); %计算长度
t=0:1/fs:(n-1)/fs;
noise=0.03*sin(2*pi*100000*t'); %100kHz 正弦波噪声
s=voice+noise; %加噪后的音频信号
rp=0.1; %通带最大衰减
rs=60; %阻带最小衰减
Ft=1000;
Fp=60; %通带截止频率fp
Fs=100; %阻带截止频率fs
wp=2*pi*Fp/Ft;%WP是通带截止频率
ws=2*pi*Fs/Ft; %WS是阻带截止频率
[n,wn]=ellipord(wp,ws,rp,rs,'s');% 调用 ellipod 计算椭圆 DF阶数 N和通带截止频率 wp,
[bz,az]=ellip(n,rp,rs,wn);% 调用 ellip 计算椭圆带通 DF系统函数系数向量B和 A
[h,w]=freqz(bz,az);
figure(5);
z=filter(bz,az,s); %滤波
figure(5);
n=length(z); %计算长度
voice1=fft(z,n);%快速傅里叶变换
plot(abs(voice1)); %绘出原始音频信号频谱
title('滤波后音频信号频域波形','FontName','宋体');
xlabel('f'); ylabel('A');
grid on;
figure(7);
plot(z); %绘出原始音频信号频谱
title(' 滤波后音频信号时域波形 ','FontName','宋体');
xlabel('f'); ylabel('A');
grid on;
clc;
close all;
感谢我的朋友赵思文轩、陈勇辉为我提供的想法和代码支持
classdef mydsp < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
dingwavButton matlab.ui.control.Button
Button_4 matlab.ui.control.Button
Button_5 matlab.ui.control.Button
Button_7 matlab.ui.control.Button
Button_8 matlab.ui.control.Button
Button_9 matlab.ui.control.Button
Button_10 matlab.ui.control.Button
Button_11 matlab.ui.control.Button
figureButton matlab.ui.control.Button
Button_12 matlab.ui.control.Button
Button_13 matlab.ui.control.Button
Button_14 matlab.ui.control.Button
end
properties (Access = public)
% Description
end
% Callbacks that handle component events
methods (Access = private)
% Callback function
function ButtonPushed(app, event)
clc;
close all;
global R;
R= audiorecorder( 44100, 16 ,1);
record(R)
R
end
% Callback function
function Button_2Pushed(app, event)
global R;
pause(R);
R
end
% Button pushed function: dingwavButton
function dingwavButtonPushed(app, event)
[voice,fs]=audioread('ding.wav');
sound(voice,fs); %声音回放
end
% Button pushed function: Button_4
function Button_4Pushed(app, event)
figure(1);
[voice,fs]=audioread('ding.wav');
plot(voice); %绘出时域波
xlabel('t'); ylabel('A'); %坐标名称
title(' 初始音频信号时域波形 ','FontName','宋体');
grid on;
end
% Button pushed function: Button_5
function Button_5Pushed(app, event)
figure(2);
[voice,fs]=audioread('ding.wav');
n=length(voice); %计算长度
voice1=fft(voice,n);%快速傅里叶变换
plot(abs(voice1)); %绘出原始音频信号频谱
title(' 初始音频信号频域波形 ','FontName','宋体');
xlabel('f'); ylabel('A');
grid on;
end
% Callback function
function Button_6Pushed(app, event)
wp=2*pi*20000;ws=2*pi*24000;Rp=0.1;As=60;
[N,wc]=buttord(wp,ws,Rp,As,'s');
[B,A]=butter(N,wc,'s');
[voice,fs]=audioread('ding.wav');
% n=length(voice); %计算长度
% voice1=filter(B,A,voice);
% voice2=fft(voice1,n);%快速傅里叶变换
% plot(abs(voice2)); %绘出原始音频信号频谱
end
% Button pushed function: Button_7
function Button_7Pushed(app, event)
[voice,fs]=audioread('ding.wav');
n=length(voice); %计算长度
t=0:1/fs:(n-1)/fs;
noise=0.03*sin(2*pi*100000*t'); %100kHz 正弦波噪声
s=voice+noise; %加噪后的音频信号
sound(s,fs); %播放加噪的语音
end
% Button pushed function: Button_8
function Button_8Pushed(app, event)
[voice,fs]=audioread('ding.wav');
n=length(voice); %计算长度
t=0:1/fs:(n-1)/fs;
noise=0.03*sin(2*pi*100000*t'); %100kHz 正弦波噪声
s=voice+noise; %加噪后的音频信号
figure(3);
n=length(s); %计算长度
voice1=fft(s,n);%快速傅里叶变换
plot(abs(voice1)); %绘出原始音频信号频谱
title(' 加噪音频信号频域波形 ','FontName','宋体');
xlabel('f'); ylabel('A');
grid on;
figure(6);
plot(s); %绘出原始音频信号频谱
title(' 加噪音频信号时域波形 ','FontName','宋体');
xlabel('f'); ylabel('A');
grid on;
end
% Button pushed function: Button_9
function Button_9Pushed(app, event)
[voice,fs]=audioread('ding.wav');
n=length(voice); %计算长度
t=0:1/fs:(n-1)/fs;
noise=0.03*sin(2*pi*100000*t'); %100kHz 正弦波噪声
s=voice+noise; %加噪后的音频信号
rp=0.1; %通带最大衰减
rs=60; %阻带最小衰减
Ft=1000;
Fp=60; %通带截止频率fp
Fs=100; %阻带截止频率fs
wp=2*pi*Fp/Ft;%WP是通带截止频率
ws=2*pi*Fs/Ft; %WS是阻带截止频率
[n,wn]=ellipord(wp,ws,rp,rs,'s');% 调用 ellipod 计算椭圆 DF阶数 N和通带截止频率 wp,
[bz,az]=ellip(n,rp,rs,wn);% 调用 ellip 计算椭圆带通 DF系统函数系数向量B和 A
[h,w]=freqz(bz,az);
figure(4);
plot(w*fs/(2*pi),abs(h)); %绘制 IIR 低通滤波器特性曲线
title('IIR 低通滤波器特性曲线 ','FontName','宋体');
grid on;
xlabel('f/Hz');ylabel(' 幅度')
end
% Button pushed function: Button_10
function Button_10Pushed(app, event)
[voice,fs]=audioread('ding.wav');
n=length(voice); %计算长度
t=0:1/fs:(n-1)/fs;
noise=0.03*sin(2*pi*100000*t'); %100kHz 正弦波噪声
s=voice+noise; %加噪后的音频信号
rp=0.1; %通带最大衰减
rs=60; %阻带最小衰减
Ft=1000;
Fp=60; %通带截止频率fp
Fs=100; %阻带截止频率fs
wp=2*pi*Fp/Ft;%WP是通带截止频率
ws=2*pi*Fs/Ft; %WS是阻带截止频率
[n,wn]=ellipord(wp,ws,rp,rs,'s');% 调用 ellipod 计算椭圆 DF阶数 N和通带截止频率 wp,
[bz,az]=ellip(n,rp,rs,wn);% 调用 ellip 计算椭圆带通 DF系统函数系数向量B和 A
[h,w]=freqz(bz,az);
z=filter(bz,az,s); %滤波
sound(z,fs); %播放加噪的语音
end
% Button pushed function: Button_11
function Button_11Pushed(app, event)
[voice,fs]=audioread('ding.wav');
n=length(voice); %计算长度
t=0:1/fs:(n-1)/fs;
noise=0.03*sin(2*pi*100000*t'); %100kHz 正弦波噪声
s=voice+noise; %加噪后的音频信号
rp=0.1; %通带最大衰减
rs=60; %阻带最小衰减
Ft=1000;
Fp=60; %通带截止频率fp
Fs=100; %阻带截止频率fs
wp=2*pi*Fp/Ft;%WP是通带截止频率
ws=2*pi*Fs/Ft; %WS是阻带截止频率
[n,wn]=ellipord(wp,ws,rp,rs,'s');% 调用 ellipod 计算椭圆 DF阶数 N和通带截止频率 wp,
[bz,az]=ellip(n,rp,rs,wn);% 调用 ellip 计算椭圆带通 DF系统函数系数向量B和 A
[h,w]=freqz(bz,az);
figure(5);
z=filter(bz,az,s); %滤波
figure(5);
n=length(z); %计算长度
voice1=fft(z,n);%快速傅里叶变换
plot(abs(voice1)); %绘出原始音频信号频谱
title('滤波后音频信号频域波形','FontName','宋体');
xlabel('f'); ylabel('A');
grid on;
figure(7);
plot(z); %绘出原始音频信号频谱
title(' 滤波后音频信号时域波形 ','FontName','宋体');
xlabel('f'); ylabel('A');
grid on;
end
% Button pushed function: figureButton
function figureButtonPushed(app, event)
clc;
close all;
end
% Button pushed function: Button_12
function Button_12Pushed(app, event)
[signal,fs] = audioread('ding.wav' );
len_signal = length( signal ); %信号的长度
T = 1/fs; %采样周期
t = T:T:len_signal/fs; %时间t序列
fft_N = 2^nextpow2( len_signal ); %计算fft变换的点数
SIGNAL = fft( signal,fft_N ); %快速傅里叶变换
SIGNAL_AMP = abs( SIGNAL ); %只做幅频分析,对fft变换后序列取模
SIGNAL_AMP_HALF = SIGNAL_AMP(1:(fft_N/2));%由于对称性,只取前一半
[SIGNAL_pks,locs] = findpeaks( SIGNAL_AMP_HALF ); %寻找频谱峰值点
sort_pks = sort( SIGNAL_pks,'descend' ); %对频谱峰值点进行排序
sort_loc = find( SIGNAL_pks>=sort_pks(2) ); %找到峰值最大的2个点排序后在pks中的位置
n1 = locs( sort_loc(1) ); %最高峰值点在序列中的位置
n2 = locs( sort_loc(2) ); %第二高峰值点在序列中的位置
Y1 = SIGNAL_AMP_HALF(n1); %最高峰值点在频谱中的幅度
Y2 = SIGNAL_AMP_HALF(n2); %第二高峰值点在频谱中的幅度
f1 = (n1-1)*fs/fft_N %最高峰值点频率
y1 = (Y1/(Y1+Y2))*cos(2*pi*f1*t); %第一个频率信号
figure(9);
plot( t,y1 ); %绘制原信号时域波形
axis( [T len_signal*T -0.08 0.08] ); %限定显示范围
title( '分解信号时域波形图1' ,'FontName','宋体'); %绘制标题
xlabel('时间(s)','FontName','宋体'); ylabel('幅值','FontName','宋体'); %绘制横纵坐标的标签
end
% Button pushed function: Button_14
function Button_14Pushed(app, event)
[signal,fs] = audioread('ding.wav' );
len_signal = length( signal ); %信号的长度
T = 1/fs; %采样周期
t = T:T:len_signal/fs; %时间t序列
fft_N = 2^nextpow2( len_signal ); %计算fft变换的点数
SIGNAL = fft( signal,fft_N ); %快速傅里叶变换
SIGNAL_AMP = abs( SIGNAL ); %只做幅频分析,对fft变换后序列取模
SIGNAL_AMP_HALF = SIGNAL_AMP(1:(fft_N/2));%由于对称性,只取前一半
[SIGNAL_pks,locs] = findpeaks( SIGNAL_AMP_HALF ); %寻找频谱峰值点
sort_pks = sort( SIGNAL_pks,'descend' ); %对频谱峰值点进行排序
sort_loc = find( SIGNAL_pks>=sort_pks(2) ); %找到峰值最大的2个点排序后在pks中的位置
n1 = locs( sort_loc(1) ); %最高峰值点在序列中的位置
n2 = locs( sort_loc(2) ); %第二高峰值点在序列中的位置
Y1 = SIGNAL_AMP_HALF(n1); %最高峰值点在频谱中的幅度
Y2 = SIGNAL_AMP_HALF(n2); %第二高峰值点在频谱中的幅度
f1 = (n1-1)*fs/fft_N; %最高峰值点频率
f2 = (n2-1)*fs/fft_N; %第二高峰值点频率
y1 = (Y1/(Y1+Y2))*cos(2*pi*f1*t); %第一个频率信号
y2 = (Y2/(Y1+Y2))*cos(2*pi*f2*t); %第二个频率信号
A = max( signal ); %原信号的最大幅度
hecheng = (y1+y2)/max( y1+y2 ); %合成信号归一化
sound( hecheng,fs ); %合成音频信号播放
end
% Button pushed function: Button_13
function Button_13Pushed(app, event)
[signal,fs] = audioread('ding.wav' );
len_signal = length( signal ); %信号的长度
T = 1/fs; %采样周期
t = T:T:len_signal/fs; %时间t序列
fft_N = 2^nextpow2( len_signal ); %计算fft变换的点数
SIGNAL = fft( signal,fft_N ); %快速傅里叶变换
SIGNAL_AMP = abs( SIGNAL ); %只做幅频分析,对fft变换后序列取模
SIGNAL_AMP_HALF = SIGNAL_AMP(1:(fft_N/2));%由于对称性,只取前一半
[SIGNAL_pks,locs] = findpeaks( SIGNAL_AMP_HALF ); %寻找频谱峰值点
sort_pks = sort( SIGNAL_pks,'descend' ); %对频谱峰值点进行排序
sort_loc = find( SIGNAL_pks>=sort_pks(2) ); %找到峰值最大的2个点排序后在pks中的位置
n1 = locs( sort_loc(1) ); %最高峰值点在序列中的位置
n2 = locs( sort_loc(2) ); %第二高峰值点在序列中的位置
Y1 = SIGNAL_AMP_HALF(n1); %最高峰值点在频谱中的幅度
Y2 = SIGNAL_AMP_HALF(n2); %第二高峰值点在频谱中的幅度
f1 = (n1-1)*fs/fft_N; %最高峰值点频率
f2 = (n2-1)*fs/fft_N %第二高峰值点频率
y2 = (Y2/(Y1+Y2))*cos(2*pi*f2*t); %第二个频率信号
figure(8)
plot( t,y2 ); %绘制原信号时域波形
axis( [T len_signal*T -0.08 0.08] ); %限定显示范围
title( '分解信号时域波形图2' ,'FontName','宋体'); %绘制标题
xlabel('时间(s)','FontName','宋体'); ylabel('幅值','FontName','宋体');
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure and hide until all components are created
app.UIFigure = uifigure('Visible', 'off');
app.UIFigure.Position = [100 100 640 480];
app.UIFigure.Name = 'UI Figure';
% Create dingwavButton
app.dingwavButton = uibutton(app.UIFigure, 'push');
app.dingwavButton.ButtonPushedFcn = createCallbackFcn(app, @dingwavButtonPushed, true);
app.dingwavButton.Position = [76 430 100 24];
app.dingwavButton.Text = '播放ding.wav';
% Create Button_4
app.Button_4 = uibutton(app.UIFigure, 'push');
app.Button_4.ButtonPushedFcn = createCallbackFcn(app, @Button_4Pushed, true);
app.Button_4.Position = [76 374 135 24];
app.Button_4.Text = '显示音频时域波形';
% Create Button_5
app.Button_5 = uibutton(app.UIFigure, 'push');
app.Button_5.ButtonPushedFcn = createCallbackFcn(app, @Button_5Pushed, true);
app.Button_5.Position = [243 373 123 25];
app.Button_5.Text = '显示音频频域波形';
% Create Button_7
app.Button_7 = uibutton(app.UIFigure, 'push');
app.Button_7.ButtonPushedFcn = createCallbackFcn(app, @Button_7Pushed, true);
app.Button_7.Position = [76 229 100 24];
app.Button_7.Text = '播放加噪信号';
% Create Button_8
app.Button_8 = uibutton(app.UIFigure, 'push');
app.Button_8.ButtonPushedFcn = createCallbackFcn(app, @Button_8Pushed, true);
app.Button_8.Position = [231 229 147 24];
app.Button_8.Text = '加噪之后的时域和频谱图';
% Create Button_9
app.Button_9 = uibutton(app.UIFigure, 'push');
app.Button_9.ButtonPushedFcn = createCallbackFcn(app, @Button_9Pushed, true);
app.Button_9.Position = [76 179 123 24];
app.Button_9.Text = '显示低通滤波器特性';
% Create Button_10
app.Button_10 = uibutton(app.UIFigure, 'push');
app.Button_10.ButtonPushedFcn = createCallbackFcn(app, @Button_10Pushed, true);
app.Button_10.Position = [249 179 111 24];
app.Button_10.Text = '播放滤波后的声音';
% Create Button_11
app.Button_11 = uibutton(app.UIFigure, 'push');
app.Button_11.ButtonPushedFcn = createCallbackFcn(app, @Button_11Pushed, true);
app.Button_11.Position = [400 179 135 24];
app.Button_11.Text = '滤波后的时域和频谱图';
% Create figureButton
app.figureButton = uibutton(app.UIFigure, 'push');
app.figureButton.ButtonPushedFcn = createCallbackFcn(app, @figureButtonPushed, true);
app.figureButton.Position = [260 96 100 24];
app.figureButton.Text = '关闭所有figure';
% Create Button_12
app.Button_12 = uibutton(app.UIFigure, 'push');
app.Button_12.ButtonPushedFcn = createCallbackFcn(app, @Button_12Pushed, true);
app.Button_12.Position = [76 291 119 26];
app.Button_12.Text = '声音主要频率1';
% Create Button_13
app.Button_13 = uibutton(app.UIFigure, 'push');
app.Button_13.ButtonPushedFcn = createCallbackFcn(app, @Button_13Pushed, true);
app.Button_13.Position = [241 291 119 26];
app.Button_13.Text = '声音主要频率2';
% Create Button_14
app.Button_14 = uibutton(app.UIFigure, 'push');
app.Button_14.ButtonPushedFcn = createCallbackFcn(app, @Button_14Pushed, true);
app.Button_14.Position = [400 291 100 26];
app.Button_14.Text = '合成声音播放';
% Show the figure after all components are created
app.UIFigure.Visible = 'on';
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = mydsp
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
end
链接:https://pan.baidu.com/s/1UMIm8A_ThtiTailmHmYnSg
提取码:6666
复制这段内容后打开百度网盘手机App,操作更方便哦