📄 do.asv
字号:
function varargout = do(varargin)
% DO M-file for do.fig
% DO, by itself, creates a new DO or raises the existing
% singleton*.
%
% H = DO returns the handle to a new DO or the handle to
% the existing singleton*.
%
% DO('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in DO.M with the given input arguments.
%
% DO('Property','Value',...) creates a new DO or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before do_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to do_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 do
% Last Modified by GUIDE v2.5 27-May-2004 10:09:05
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @do_OpeningFcn, ...
'gui_OutputFcn', @do_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin & isstr(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 do is made visible.
function do_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 do (see VARARGIN)
% Choose default command line output for do
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes do wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = do_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;
function [y1,f]=plot_fig(x,fs)
y=fft(x,1024);
%m=length(y);
%u=linspace(0,m,m);
y1=y(1:512);
f=(0:511)/511*(fs/2);
%axes([-500 1000 0 500]);
subplot(3,1,3);
%plot(u,abs(y));
plot(f,abs(y1));
xlabel('频率')
ylabel('幅度')
title('频域信号图');% --- 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)
n=1:2600;
fs=8192;
fdo=261.63;
do=sin(n*2*pi*fdo/fs);
soundsc(do,fs);
subplot(3,1,2);
plot(do(1:200))
xlabel('时间')
ylabel('幅度')
title('时域信号图');
plot_fig(do,fs);% --- 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)
n=1:2600;
fs=8192;
fdo=261.63;
fre=fdo*power(2,2/12);
re=sin(n*2*pi*fre/fs);soundsc(re,fs);
subplot(3,1,2);
plot(re(1:200))xlabel('时间')
ylabel('幅度')
title('时域信号图');
plot_fig(re,fs);% --- 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)
n=1:2600;
fs=8192;
fdo=261.63;
fmi=fdo*power(2,4/12);
mi=sin(n*2*pi*fmi/fs);soundsc(mi,fs);
subplot(3,1,2);
plot(mi(1:200))xlabel('时间')
ylabel('幅度')
title('时域信号图');
plot_fig(mi,fs);% --- Executes on button press in pushbutton4.function pushbutton4_Callback(hObject, eventdata, handles)% hObject handle to pushbutton4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
n=1:2600;
fs=8192;
fdo=261.63;
ffa=fdo*power(2,5/12);
fa=sin(n*2*pi*ffa/fs);soundsc(fa,fs);
subplot(3,1,2);
plot(fa(1:200))xlabel('时间')
ylabel('幅度')
title('时域信号图');
plot_fig(fa,fs);% --- Executes on button press in pushbutton5.function pushbutton5_Callback(hObject, eventdata, handles)% hObject handle to pushbutton5 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
n=1:2600;
fs=8192;
fdo=261.63;
fso=fdo*power(2,7/12);
so=sin(n*2*pi*fso/fs);soundsc(so,fs);
subplot(3,1,2);
plot(so(1:200))xlabel('时间')
ylabel('幅度')
title('时域信号图');
plot_fig(so,fs);
% --- Executes on button press in pushbutton6.function pushbutton6_Callback(hObject, eventdata, handles)% hObject handle to pushbutton6 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)n=1:2600;
fs=8192;
fdo=261.63;
fla=fdo*power(2,9/12);
la=sin(2*n*pi*fla/fs);soundsc(la,fs);
subplot(3,1,2);
plot(la(1:200))
xlabel('时间')
ylabel('幅度')
title('时域信号图');
plot_fig(la,fs);
% --- Executes on button press in pushbutton7.function pushbutton7_Callback(hObject, eventdata, handles)% hObject handle to pushbutton7 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)n=1:2600;
fs=8192;
fdo=261.63;
fsi=fdo*power(2,11/12);
si=sin(2*n*pi*fsi/fs);soundsc(si,fs);
subplot(3,1,2);
plot(si(1:200))xlabel('时间')
ylabel('幅度')title('时域信号图');
plot_fig(si,fs);% --- 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)n=1:2600;
fs=8192;
fdo=261.63;
fH=fdo*power(2,1/12);
H=sin(n*2*pi*fH/fs);
soundsc(H,fs);
subplot(3,1,2);
plot(H(1:200))xlabel('时间')
ylabel('幅度')
title('时域信号图');
plot_fig(H,fs);% --- 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)n=1:2600;
fs=8192;
fdo=261.63;
fI=fdo*power(2,3/12);
I=sin(n*2*pi*fI/fs);
soundsc(I,fs);
subplot(3,1,2);
plot(I(1:200))xlabel('时间')
ylabel('幅度')
title('时域信号图');
plot_fig(I,fs);% --- 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)n=1:2600;
fs=8192;
fdo=261.63;
fJ=fdo*power(2,6/12);
J=sin(n*2*pi*fJ/fs);
soundsc(J,fs);
subplot(3,1,2);
plot(J(1:200))xlabel('时间')
ylabel('幅度')
title('时域信号图');
plot_fig(J,fs);% --- 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)n=1:2600;
fs=8192;
fdo=261.63;
fK=fdo*power(2,8/12);
K=sin(n*2*pi*fK/fs);
soundsc(K,fs);
subplot(3,1,2);
plot(K(1:200))xlabel('时间')
ylabel('幅度')
title('时域信号图');
plot_fig(K,fs);% --- 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)n=1:2600;
fs=8192;
fdo=261.63;
fL=fdo*power(2,10/12);
L=sin(n*2*pi*fL/fs);
soundsc(L,fs);
subplot(3,1,2);
plot(L(1:200))xlabel('时间')
ylabel('幅度')title('时域信号图');
plot_fig(L,fs);% --- 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)n=1:2600;
fs=8192;
fdo=261.63;
fsi=fdo*power(2,11/12);
fsii=fsi/2;
sii=sin(n*2*pi*fsii/fs);
soundsc(sii,fs);
subplot(3,1,2);
plot(sii(1:200))
xlabel('时间')
ylabel('幅度')
title('时域信号图');
plot_fig(sii,fs);
% --- Executes on button press in pushbutton16.function pushbutton16_Callback(hObject, eventdata, handles)% hObject handle to pushbutton16 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)n=1:2600;
fs=8192;
fdo=261.63;
fla=fdo*power(2,9/12);
flai=fla/2;
lai=sin(2*n*pi*flai/fs);
soundsc(lai,fs);
subplot(3,1,2);
plot(lai(1:200))
xlabel('时间')
ylabel('幅度')
title('时域信号图');
plot_fig(lai,fs);% --- Executes on button press in pushbutton17.function pushbutton17_Callback(hObject, eventdata, handles)% hObject handle to pushbutton17 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)n=1:2600;
fs=8192;
fdo=261.63;
fso=fdo*power(2,7/12);
fsoi=fso/2;
soi=sin(n*2*pi*fsoi/fs);
soundsc(soi,fs);
subplot(3,1,2);
plot(soi(1:200))
xlabel('时间')
ylabel('幅度')title('时域信号图');
plot_fig(soi,fs);% --- Executes on button press in pushbutton18.function pushbutton18_Callback(hObject, eventdata, handles)% hObject handle to pushbutton18 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)n=1:2600;
fs=8192;
fdo=261.63;
ffa=fdo*power(2,5/12);
ffai=ffa/2;
fai=sin(n*2*pi*ffai/fs);
soundsc(fai,fs);
subplot(3,1,2);
plot(fai(1:200))
xlabel('时间')
ylabel('幅度')title('时域信号图');
plot_fig(fai,fs);% --- Executes on button press in pushbutton19.function pushbutton19_Callback(hObject, eventdata, handles)% hObject handle to pushbutton19 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)n=1:2600;
fs=8192;
fdo=261.63;
fL=fdo*power(2,10/12);
fLi=fL/2;
Li=sin(n*2*pi*fLi/fs);
soundsc(Li,fs);
subplot(3,1,2);
plot(Li(1:200))
xlabel('时间')
ylabel('幅度')
title('时域信号图');
plot_fig(Li,fs);
% --- Executes on button press in pushbutton20.function pushbutton20_Callback(hObject, eventdata, handles)% hObject handle to pushbutton20 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)n=1:2600;
fs=8192;
fdo=261.63;
fK=fdo*power(2,8/12);
fKi=fK/2;
Ki=sin(n*2*pi*fKi/fs);
soundsc(Ki,fs);
subplot(3,1,2);
plot(Ki(1:200))
xlabel('时间')
ylabel('幅度')
title('时域信号图');
plot_fig(Ki,fs);% --- Executes on button press in pushbutton21.function pushbutton21_Callback(hObject, eventdata, handles)% hObject handle to pushbutton21 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)n=1:2600;
fs=8192;
fdo=261.63;
fJ=fdo*power(2,6/12);
fJi=fJ/2;
Ji=sin(n*2*pi*fJi/fs);
soundsc(Ji,fs);
subplot(3,1,2);
plot(Ji(1:200))
xlabel('时间')
ylabel('幅度')
title('时域信号图');
plot_fig(Ji,fs);% --- Executes on button press in pushbutton22.function pushbutton22_Callback(hObject, eventdata, handles)% hObject handle to pushbutton22 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) n=1:2600;
fs=8192;
fdo=261.63;
fdoj=fdo*2;
doj=sin(n*2*pi*fdoj/fs);
soundsc(doj,fs);
subplot(3,1,2);
plot(doj(1:200))
xlabel('时间')
ylabel('幅度')
title('时域信号图');
plot_fig(doj,fs);% --- Executes on button press in pushbutton23.function pushbutton23_Callback(hObject, eventdata, handles)% hObject handle to pushbutton23 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)n=1:2600;
fs=8192;
fdo=261.63;
fre=fdo*power(2,2/12);
frej=fre*2;
rej=sin(n*2*pi*frej/fs);
soundsc(rej,fs);
subplot(3,1,2);
plot(rej(1:200))
xlabel('时间')
ylabel('幅度')
title('时域信号图');
plot_fig(rej,fs);% --- Executes on button press in pushbutton24.function pushbutton24_Callback(hObject, eventdata, handles)% hObject handle to pushbutton24 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)n=1:2600;
fs=8192;
fdo=261.63;
fmi=fdo*power(2,4/12);
fmij=fmi*2;
mij=sin(n*2*pi*fmij/fs);
soundsc(mij,fs);
subplot(3,1,2);
plot(mij(1:200))
xlabel('时间')
ylabel('幅度')
title('时域信号图');
plot_fig(mij,fs);% --- Executes on button press in pushbutton25.function pushbutton25_Callback(hObject, eventdata, handles)% hObject handle to pushbutton25 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)n=1:2600;
fs=8192;
fdo=261.63;
fH=fdo*power(2,1/12);
fHj=fH*2;
Hj=sin(n*2*pi*fHj/fs);
soundsc(Hj,fs);
subplot(3,1,2);
plot(Hj(1:200))
xlabel('时间')
ylabel('幅度')
title('时域信号图');
plot_fig(Hj,fs);% --- Executes on button press in pushbutton26.function pushbutton26_Callback(hObject, eventdata, handles)% hObject handle to pushbutton26 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)n=1:2600;
fs=8192;
fdo=261.63;
fI=fdo*power(2,3/12);
fIj=fI*2;
Ij=sin(n*2*pi*fIj/fs);
soundsc(Ij,fs);
subplot(3,1,2);
plot(Ij(1:200))
xlabel('时间')
ylabel('幅度')
title('时域信号图');
plot_fig(Ij,fs);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -