📄 erjiexitong.asv
字号:
function varargout = erjiexitong(varargin)
% ERJIEXITONG M-file for erjiexitong.fig
% ERJIEXITONG, by itself, creates a new ERJIEXITONG or raises the existing
% singleton*.
%
% H = ERJIEXITONG returns the handle to a new ERJIEXITONG or the handle to
% the existing singleton*.
%
% ERJIEXITONG('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in ERJIEXITONG.M with the given input arguments.
%
% ERJIEXITONG('Property','Value',...) creates a new ERJIEXITONG or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before erjiexitong_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to erjiexitong_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 erjiexitong
% Last Modified by GUIDE v2.5 09-May-2007 18:13:25
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @erjiexitong_OpeningFcn, ...
'gui_OutputFcn', @erjiexitong_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 erjiexitong is made visible.
function erjiexitong_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 erjiexitong (see VARARGIN)
% Choose default command line output for erjiexitong
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes erjiexitong wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = erjiexitong_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 during object creation, after setting all properties.function popupmenu1_CreateFcn(hObject, eventdata, handles)% hObject handle to popupmenu1 (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 set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on selection change in popupmenu1.function popupmenu1_Callback(hObject, eventdata, handles)% hObject handle to popupmenu1 (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 popupmenu1 contents as cell array% contents{get(hObject,'Value')} returns selected item from popupmenu1% --- 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 set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));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 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 set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction 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 edit4_CreateFcn(hObject, eventdata, handles)% hObject handle to edit4 (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 set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction edit4_Callback(hObject, eventdata, handles)% hObject handle to edit4 (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 edit4 as text% str2double(get(hObject,'String')) returns contents of edit4 as a double% --- 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)K = str2double(get(handles.edit2,'String'));
i = str2double(get(handles.edit3,'String'));
wn = str2double(get(handles.edit4,'String'));
deta=str2double(get(handles.edit6,'String'));
%把三个界面输入数据值赋值给三个变量
val1 = get(handles.popupmenu1,'Value');
%取出输入信号1,2的选择值
switch val1
case 1
if i==0;
t=[0:0.05:60];
y1=K*(1-cos(wn*t));
else if i>0&i<1;
t=[0:0.05:60];
wd=wn*((1-i.^2).^0.5);
seta=acos(i);
A=exp(-i*wn*t);
B=sin(wd*t+seta)/((1-i.^2).^0.5);
y1=K*(1-A.*B);
else if i==1;
t=[0:0.05:40];
A=exp(-wn*t);
B=1+wn*t;
y1=K*(1-(A.*B));
else if i>1;
t=[0:0.05:60];
s1=-i*wn+((wn*(i.^2)-1).^0.5);
s2=-i*wn-((wn*(i.^2)-1).^0.5);
T1=-1/(4*s1);
T2=-1/(4*s2);
A=1/(T2/T1-1);
B=1/(T1/T2-1);
y1=K*(1+A.*exp(-t/T1)+B.*exp(-t/T2));
end
end
end
end
case 2
if i==0;
t=[0:0.05:40];
m=sin(wn*t);
y1=K*(t-m/wn);
else if i>0&i<1;
t=[0:0.05:40];
wd=wn*((1-i.^2).^0.5);
seta=acos(i);
n=exp(-i*wn*t);
o=cos(wd*t+seta);
m=i*wn*(n.*o-cos(seta));
p=(1-i.^2).^0.5;
q=wd*(i*wn-1)*p;
y1=K*(t-m./q);
else if i==1;
t=[0:0.05:40];
y1=K*(t+2.*exp(-wn*t)./wn+t.*exp(-wn*t)-2/wn);
else if i>1;
t=[0:0.05:80];
s1=-i*wn+((wn*(i.^2)-1).^0.5);
s2=-i*wn-((wn*(i.^2)-1).^0.5);
T1=-1/(4*s1);
T2=-1/(4*s2);
A=1/(T2/T1-1);
B=1/(T1/T2-1);
m=A*T1*exp(-t/T1);
n=B*T2*exp(-t/T2);
y1=K*(t-m+A.*T1-n+B.*T2);
end
end
end
end
case 3
if i==0;
t=[0:0.05:40];
y1=K*wn*sin(wn*t);
else if i>0&i<1;
t=[0:0.05:40];
wd=wn*((1-i.^2).^0.5);
seta=acos(i);
n=exp(-i*wn*t);
o=wd*cos(wd*t+seta);
q=i*wn*sin(wd*t+seta);
p=(1-i.^2).^0.5;
m=n./p;
y1=K*m.*(q-o);
else if i==1;
t=[0:0.05:40];
y1=K*t*(wn^2).*exp(-wn*t);
else if i>1;
t=[0:0.05:60];
s1=-i*wn-((wn*(i.^2)-1).^0.5);
s2=-i*wn+((wn*(i.^2)-1).^0.5);
T1=-1/(4*s1);
T2=-1/(4*s2);
A=1/(T2/T1-1);
B=1/(T1/T2-1);
m=-(A/T1).*exp(-t/T1);
n=-(B/T2).*exp(-t/T2);
y1=K*(m+n);
end
end
end
end
end
axes(handles.axes1)
% 选择合适的坐标显示区,显示在上一个图形显示区内
plot(t,y1,'-r')
%坐标分别以t,y1为横竖坐标,用红色的直线显示出来
set(handles.axes1,'XMinorTick','on')
grid on
%显示网
val2 = get(handles.popupmenu2,'Value');
m=(1-i.^2).^0.5;
wd=wn*m;
seta=acos(i)
switch val2
case 1
y2=(exp(-pi*i/m))*(100%);
case 2
A=log(1/(deta*m));
y2=A/(i*wn);
case 3
y2=(pi-seta)/wd;
case 4
y2=pi/wd;
case 5
B=A/(i*wn);
tf=(2*pi)/wd;
y2=B./tf;
case 6
y2=0
end
set(handles.text20,'string',y2)% --- 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)close
dongtaixiangying% --- Executes during object creation, after setting all properties.function edit5_CreateFcn(hObject, eventdata, handles)% hObject handle to edit5 (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 set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction edit5_Callback(hObject, eventdata, handles)% hObject handle to edit5 (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 edit5 as text% str2double(get(hObject,'String')) returns contents of edit5 as a double% --- Executes during object creation, after setting all properties.function popupmenu2_CreateFcn(hObject, eventdata, handles)% hObject handle to popupmenu2 (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 set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on selection change in popupmenu2.function popupmenu2_Callback(hObject, eventdata, handles)% hObject handle to popupmenu2 (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 popupmenu2 contents as cell array% contents{get(hObject,'Value')} returns selected item from popupmenu2% --- Executes during object creation, after setting all properties.function edit6_CreateFcn(hObject, eventdata, handles)% hObject handle to edit6 (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 set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction edit6_Callback(hObject, eventdata, handles)% hObject handle to edit6 (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 edit6 as text% str2double(get(hObject,'String')) returns contents of edit6 as a double
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -