⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 diyi.m

📁 都是一些matlab图形用户界面的设计实例
💻 M
📖 第 1 页 / 共 2 页
字号:
% 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 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% --- Executes during object creation, after setting all properties.function edit7_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit7 (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 edit7_Callback(hObject, eventdata, handles)% hObject    handle to edit7 (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 edit7 as text%        str2double(get(hObject,'String')) returns contents of edit7 as a double% --------------------------------------------------------------------function Untitled_18_Callback(hObject, eventdata, handles)% hObject    handle to Untitled_18 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global A,
global B,
global C,
global D,
%str=get(handles.edit10,'string');
%a=eval(str);
%str=get(handles.edit11,'string');
%b=eval(str);
%str=get(handles.edit3,'string');
%c=eval(str);
%str=get(handles.edit4,'string');
%d=eval(str);
sys=ss(A,B,C,D);
[v,w]=eig(A);
sysT=ss2ss(sys,v);
[P,Q,J,K]=ssdata(sysT);
p=num2str(P);
q=num2str(Q);
j=num2str(J);
k=num2str(K);
set(handles.text31,'string',p);
set(handles.text32,'string',q);
set(handles.text33,'string',j);
set(handles.text34,'string',k);

% --------------------------------------------------------------------function Untitled_19_Callback(hObject, eventdata, handles)% hObject    handle to Untitled_19 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)
global A,
global B,
global C,
global D,
%str=get(handles.edit10,'string');
%a=eval(str);
%str=get(handles.edit11,'string');
%b=eval(str);
%str=get(handles.edit3,'string');
%c=eval(str);
%str=get(handles.edit4,'string');
%d=eval(str);
sys=ss(A,B,C,D);
[v,w]=eig(A);
u=inv(v);
sysT=ss2ss(sys,u);
[P,Q,J,K]=ssdata(sysT);
p=num2str(P);
q=num2str(Q);
j=num2str(J);
k=num2str(K);
set(handles.text27,'string',p);
set(handles.text28,'string',q);
set(handles.text29,'string',j);
set(handles.text30,'string',k);% --------------------------------------------------------------------function Untitled_20_Callback(hObject, eventdata, handles)% hObject    handle to Untitled_20 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global num1
global den1%str=get(handles.edit8,'string');
%num=eval(str);
%str=get(handles.edit9,'string');
%den1=eval(str);
w=logspace(-1,2);
figure(1)
bode(num1,den1,w);





% --------------------------------------------------------------------function Untitled_21_Callback(hObject, eventdata, handles)% hObject    handle to Untitled_21 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global num1
global den1%str=get(handles.edit8,'string');
%num=eval(str);
%str=get(handles.edit9,'string');
%den=eval(str);
figure(1)
nyquist(num1,den1,{1/57.3,100/57.3})
% --------------------------------------------------------------------function Untitled_22_Callback(hObject, eventdata, handles)% hObject    handle to Untitled_22 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global num1
global den1%str=get(handles.edit8,'string');
%a=eval(str);
%str=get(handles.edit9,'string');
%b=eval(str);
figure(1)
rlocus(num1,den1)% --------------------------------------------------------------------function Untitled_23_Callback(hObject, eventdata, handles)% hObject    handle to Untitled_23 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function Untitled_24_Callback(hObject, eventdata, handles)% hObject    handle to Untitled_24 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global num1
global den1

%str=get(handles.edit8,'string');
%num=eval(str);
%str=get(handles.edit9,'string');
%den=eval(str);
%[A,B,C,D]=tf2ss(num,den);
t=0:0.1:10;
%y=impulse(A,B,C,D,1,t);
y=impulse(num1,den1,t)
plot(t,y)xlabel('脉冲响应')% --------------------------------------------------------------------function Untitled_26_Callback(hObject, eventdata, handles)% hObject    handle to Untitled_26 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global num1
global den1%str=get(handles.edit8,'string');
%num=eval(str);
%str=get(handles.edit9,'string');
%den=eval(str);
%[A,B,C,D]=tf2ss(num,den);
t=0:0.1:10
%y=step(A,B,C,D,1,t);
y=step(num1,den1,t)
plot(t,y)
xlabel('时间t')
ylabel('阶越响应y')

% --- Executes during object creation, after setting all properties.function edit8_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit8 (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 edit8_Callback(hObject, eventdata, handles)% hObject    handle to edit8 (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 edit8 as text%        str2double(get(hObject,'String')) returns contents of edit8 as a double% --- Executes during object creation, after setting all properties.function edit9_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit9 (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 edit9_Callback(hObject, eventdata, handles)% hObject    handle to edit9 (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 edit9 as text%        str2double(get(hObject,'String')) returns contents of edit9 as a double% --------------------------------------------------------------------function Untitled_27_Callback(hObject, eventdata, handles)% hObject    handle to Untitled_27 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function Untitled_28_Callback(hObject, eventdata, handles)% hObject    handle to Untitled_28 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global num1
global den1


%str=get(handles.edit8,'string');
%num1=eval(str);
%str=get(handles.edit9,'string');
%den1=eval(str);
sim('s');
plot(t,y);% --- Executes during object creation, after setting all properties.function edit10_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit10 (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 edit10_Callback(hObject, eventdata, handles)% hObject    handle to edit10 (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 edit10 as text%        str2double(get(hObject,'String')) returns contents of edit10 as a double% --- Executes during object creation, after setting all properties.function edit11_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit11 (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 edit11_Callback(hObject, eventdata, handles)% hObject    handle to edit11 (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 edit11 as text%        str2double(get(hObject,'String')) returns contents of edit11 as a double

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -