function varargout = xiongbawuxia(varargin)
% XIONGBAWUXIA MATLAB code for xiongbawuxia.fig
% XIONGBAWUXIA, by itself, creates a new XIONGBAWUXIA or raises the existing
% singleton*.
%
% H = XIONGBAWUXIA returns the handle to a new XIONGBAWUXIA or the handle to
% the existing singleton*.
%
% XIONGBAWUXIA('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in XIONGBAWUXIA.M with the given input arguments.
%
% XIONGBAWUXIA('Property','Value',...) creates a new XIONGBAWUXIA or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before xiongbawuxia_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to xiongbawuxia_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help xiongbawuxia
% Last Modified by GUIDE v2.5 28-Oct-2016 21:08:47
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @xiongbawuxia_OpeningFcn, ...
'gui_OutputFcn', @xiongbawuxia_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before xiongbawuxia is made visible.
function xiongbawuxia_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to xiongbawuxia (see VARARGIN)
% Choose default command line output for xiongbawuxia
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes xiongbawuxia wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = xiongbawuxia_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global y fs n t f Y;
[y,fs]=audioread('1.wma');
y=y(:,2);
p = audioplayer(y,fs);
play(p);
pause(5);
n=length(y);
t=(0:n-1)/fs;
axes(handles.axes1);
plot(t,y);
title('原始语音信号采样后的波形图');
f=fs*(0:n/2-1)/n;
Y=fft(y,n);
axes(handles.axes2);
plot(f,abs(Y(1:n/2)));;
title('原始语音信号采样后的频谱图');
% --- Executes on button press in pushbutton8.
function pushbutton8_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton9.
function pushbutton9_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global y fs n t f d;
Au=0.1;
d=[Au*cos(2*pi*4000*t)]';
z=fft(d,n);
axes(handles.axes1);
plot(f,abs(z(1:n/2)));
title('高频噪音的频谱图');
% --- Executes on button press in pushbutton10.
function pushbutton10_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton10 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global y fs n f d r t v ;
r=y+d;
u=audioplayer(r,fs);
play(u);
pause(5);
t=(0:length(r)-1)/fs;
axes(handles.axes1);
plot(t,r);
set(gca,'ylim',[-1 1]);
title('信号加高噪波形图');
% t=(0:n-1)/fs;
% axes(handles.axes2);
% plot(t,y);
% title('原始语音信号采样后的波形图');
% set(gca,'ylim',[-1.5 1.5])
% set(gca,'xlim',[0 30])
v=fft(r,n);
axes(handles.axes2);
plot(f,abs(v(1:n/2)));
title('信号加高噪频谱图');
% --- Executes on button press in pushbutton11.
function pushbutton11_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton11 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global fs b a
M=11;
b=ones(M,1)/M;
a=1;
[q,w]=freqz(b,a,'whole');
p=(abs(q));
f1=w*fs/(2*pi);
axes(handles.axes1);
plot(f1,p);
set(gca,'xlim',[0 fs/2]);
title('滤波器幅度频谱图');
c=angle(q);
axes(handles.axes2);
plot(f1,c);
set(gca,'xlim',[0 fs/2]);
title('滤波器相位频谱图');
% --- Executes on button press in pushbutton12.
function pushbutton12_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton12 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global fs b a r t f n u e
e=filter(b,a,r);
c=audioplayer(e,fs);
play(c);
pause(5);
axes(handles.axes1);
plot(t,e);
set(gca,'ylim',[-1 1]);
title('滤波后的波形图');
u=fft(e,n);
axes(handles.axes2);
plot(f,abs(u(1:n/2)));
title('滤波后的频谱图');
% --- Executes on button press in pushbutton13.
function pushbutton13_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton13 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global r t e ;
axes(handles.axes1);
plot(t,r);
set(gca,'ylim',[-1 1]);
title('信号加高噪波形图');
axes(handles.axes2);
plot(t,e);
set(gca,'ylim',[-1 1]);
title('滤波后的波形图');
% --- Executes on button press in pushbutton14.
function pushbutton14_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton14 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global n f v u;
axes(handles.axes1);
plot(f,abs(v(1:n/2)));
title('信号加高噪频谱图');
axes(handles.axes2);
plot(f,abs(u(1:n/2)));
title('滤波后的频谱图');
% --- Executes on button press in pushbutton15.
function pushbutton15_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton15 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global d1 n f t Y;
axes(handles.axes1);
plot(f
评论0