📄 nature.m
字号:
function varargout = nature(varargin)%NATURE M-file for nature.fig% NATURE, by itself, creates a new NATURE or raises the existing% singleton*.%% H = NATURE returns the handle to a new NATURE or the handle to% the existing singleton*.%% NATURE('Property','Value',...) creates a new NATURE using the% given property value pairs. Unrecognized properties are passed via% varargin to nature_OpeningFcn. This calling syntax produces a% warning when there is an existing singleton*.%% NATURE('CALLBACK') and NATURE('CALLBACK',hObject,...) call the% local function named CALLBACK in NATURE.M with the given input% arguments.%% *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 nature% Last Modified by GUIDE v2.5 20-Jul-2008 15:51:05% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @nature_OpeningFcn, ... 'gui_OutputFcn', @nature_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 nature is made visible.function nature_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 unrecognized PropertyName/PropertyValue pairs from the% command line (see VARARGIN)% Choose default command line output for naturehandles.output = hObject;% Update handles structureguidata(hObject, handles);% UIWAIT makes nature wait for user response (see UIRESUME)% uiwait(handles.figure1);% --- Outputs from this function are returned to the command line.function varargout = nature_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 selection change in popupmenu_zeta.function popupmenu_zeta_Callback(hObject, eventdata, handles)val=get(hObject,'value')switch val case 1 handles.data=0 case 2 handles.data=0.3 case 3 handles.data=0.5 case 4 handles.data=0.707end guidata(hObject,handles)% hObject handle to popupmenu_zeta (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 popupmenu_zeta contents as cell array% contents{get(hObject,'Value')} returns selected item from popupmenu_zeta% --- Executes during object creation, after setting all properties.function popupmenu_zeta_CreateFcn(hObject, eventdata, handles)% hObject handle to popupmenu_zeta (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: popupmenu 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 pushbutton_red.function pushbutton_red_Callback(hObject, eventdata, handles)x=0:0.1:20;zeta=handles.datay=1-1/sqrt(1-zeta^2)*exp(-zeta*x).*sin(sqrt(1-zeta^2)*x+acos(zeta));plot(x,y,'r')% hObject handle to pushbutton_red (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 pushbutton_blue.function pushbutton_blue_Callback(hObject, eventdata, handles)x=0:0.1:20;zeta=handles.datay=1-1/sqrt(1-zeta^2)*exp(-zeta*x).*sin(sqrt(1-zeta^2)*x+acos(zeta));plot(x,y,'b')% hObject handle to pushbutton_blue (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -