📄 juanji.m
字号:
function varargout = juanji(varargin)% JUANJI M-file for juanji.fig% JUANJI, by itself, creates a new JUANJI or raises the existing% singleton*.%% H = JUANJI returns the handle to a new JUANJI or the handle to% the existing singleton*.%% JUANJI('CALLBACK',hObject,eventData,handles,...) calls the local% function named CALLBACK in JUANJI.M with the given input arguments.%% JUANJI('Property','Value',...) creates a new JUANJI or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before juanji_OpeningFcn gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to juanji_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 juanji% Last Modified by GUIDE v2.5 28-May-2008 19:19:03% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @juanji_OpeningFcn, ... 'gui_OutputFcn', @juanji_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []);if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1});endif 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 juanji is made visible.function juanji_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 juanji (see VARARGIN)% Choose default command line output for juanjihandles.output = hObject;% Update handles structureguidata(hObject, handles);% UIWAIT makes juanji wait for user response (see UIRESUME)% uiwait(handles.figure1);% --- Outputs from this function are returned to the command line.function varargout = juanji_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 structurevarargout{1} = handles.output;% --- Executes on button press in radiobutton1.function radiobutton1_Callback(hObject, eventdata, handles)hold offt1=0;t2=10;dt=0.1;t=t1:dt:t2;A1=1;hfstext=findobj('tag','edit1');h=get(hfstext,'string');a1=str2num(h);n=A1*exp(-a1*t);axes(handles.axes1);plot(t,n);xlabel('时间(t)');title('输入信号');% hObject handle to radiobutton1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hint: get(hObject,'Value') returns toggle state of radiobutton1% --- Executes on button press in radiobutton2.function radiobutton2_Callback(hObject, eventdata, handles) hold offt0=0;t1=-1;t2=3;hfstext=findobj('tag','edit2');h=get(hfstext,'string');dt=str2num(h);t=t1:dt:-t0;n=length(t);t3=-t0:dt:t2;n3=length(t3);u=zeros(1,n);u3=ones(1,n3);plot(t,u);hold on;axes(handles.axes1);plot(t3,u3);plot([-t0,-t0],[0,1]);xlabel('时间(t)');title('卷积结果');% hObject handle to radiobutton2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hint: get(hObject,'Value') returns toggle state of radiobutton2function edit1_Callback(hObject, eventdata, handles)% hObject handle to edit1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit1 as text% str2double(get(hObject,'String')) returns contents of edit1 as a double% --- Executes during object creation, after setting all properties.function edit1_CreateFcn(hObject, eventdata, handles)% hObject handle to edit1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');endfunction edit2_Callback(hObject, eventdata, handles)% hObject handle to edit2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit2 as text% str2double(get(hObject,'String')) returns contents of edit2 as a double% --- Executes during object creation, after setting all properties.function edit2_CreateFcn(hObject, eventdata, handles)% hObject handle to edit2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');end% --- Executes on button press in radiobutton3.function radiobutton3_Callback(hObject, eventdata, handles)hold off;t0=0;t1=-1;t2=3;hfstext1=findobj('tag','edit3');h1=get(hfstext1,'string');dt=str2num(h1);t=t1:dt:t2;n=length(t);k1=floor((t0-t1)/dt);x=zeros(1,n);x(k1)=1/dt;axes(handles.axes1);stairs(t,x);% hObject handle to radiobutton3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hint: get(hObject,'Value') returns toggle state of radiobutton3function edit3_Callback(hObject, eventdata, handles)% hObject handle to edit3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit3 as text% str2double(get(hObject,'String')) returns contents of edit3 as a double% --- Executes during object creation, after setting all properties.function edit3_CreateFcn(hObject, eventdata, handles)% hObject handle to edit3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');end% --- Executes during object creation, after setting all properties.function axes2_CreateFcn(hObject, eventdata, handles)conv% hObject handle to axes2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: place code in OpeningFcn to populate axes2% --- Executes on selection change in listbox1.function listbox1_Callback(hObject, eventdata, handles)val=get(handles.listbox1 ,'Value');switch valcase 1 hold off t1=0;t2=10;dt=0.1;t=t1:dt:t2;A1=1;hfstext=findobj('tag','edit1');h=get(hfstext,'string');a1=str2num(h);n=A1*exp(-a1*t);plot(t,n);t1=0;t2=10;dt=0.1;t=t1:dt:t2;A1=1;a1=1n=A1*exp(-a1*t);axes(handles.axes2);conv(n,n) case 3 hold off t1=0;t2=10;dt=0.1;t=t1:dt:t2;A1=1;hfstext=findobj('tag','edit1');h=get(hfstext,'string');a1=str2num(h);n=A1*exp(-a1*t);plot(t,n);t1=-5:1/100:5;stepfun(t1,0);f1=stepfun(t1,0);axes(handles.axes2);conv(n,f1)case 2 hold offt1=0;t2=10;dt=0.1;t=t1:dt:t2;A1=1;hfstext=findobj('tag','edit1');h=get(hfstext,'string');a1=str2num(h);n=A1*exp(-a1*t);axes(handles.axes2);plot(t,n);hold off;t0=0;t1=-1;t2=3;dt=0.1t=t1:dt:t2;n=length(t);k1=floor((t0-t1)/dt);x=zeros(1,n);x(k1)=1/dt;axes(handles.axes2);stairs(t,x);f1=stairs(t,x);axes(handles.axes2);conv(n,f1)case 4 case 5 end% hObject handle to listbox1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns listbox1 contents as cell array% contents{get(hObject,'Value')} returns selected item from listbox1% --- Executes during object creation, after setting all properties.function listbox1_CreateFcn(hObject, eventdata, handles)% hObject handle to listbox1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: listbox controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');end% --- Executes on button press in pushbutton1.function pushbutton1_Callback(hObject, eventdata, handles)close;main% 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 checkbox1.function checkbox1_Callback(hObject, eventdata, handles)r=get(hObject,'value');if r==1 grid onelse grid offend% hObject handle to checkbox1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hint: get(hObject,'Value') returns toggle state of checkbox1% --- Executes on button press in checkbox2.function checkbox2_Callback(hObject, eventdata, handles)r=get(hObject,'value');if r==1 zoom onelse zoom offend% hObject handle to checkbox2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hint: get(hObject,'Value') returns toggle state of checkbox2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -