function varargout = pid_opt_pj(varargin)
% PID_OPT_PJ M-file for pid_opt_pj.fig
% PID_OPT_PJ, by itself, creates a new PID_OPT_PJ or raises the existing
% singleton*.
%
% H = PID_OPT_PJ returns the handle to a new PID_OPT_PJ or the handle to
% the existing singleton*.
%
% PID_OPT_PJ('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in PID_OPT_PJ.M with the given input arguments.
%
% PID_OPT_PJ('Property','Value',...) creates a new PID_OPT_PJ or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before pid_opt_pj_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to pid_opt_pj_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
% Copyright 2002-2003 The MathWorks, Inc.
% Edit the above text to modify the response to help pid_opt_pj
% Last Modified by GUIDE v2.5 30-Apr-2022 09:11:18
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @pid_opt_pj_OpeningFcn, ...
'gui_OutputFcn', @pid_opt_pj_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(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 pid_opt_pj is made visible.
function pid_opt_pj_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 pid_opt_pj (see VARARGIN)
% Choose default command line output for pid_opt_pj
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes pid_opt_pj wait for user response (see UIRESUME)
% uiwait(handles.figure_pid_opt_pj);
setappdata(handles.axes1,'tout',0);
setappdata(handles.axes1,'yout',0);
set(handles.btn_no_pid,'Enable','on');
set(handles.btn_pid,'Enable','on');
set(handles.btn_reset,'Enable','on');
% --- Outputs from this function are returned to the command line.
function varargout = pid_opt_pj_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 edit_pid_Callback(hObject, eventdata, handles)
% hObject handle to edit_pid (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 edit_pid as text
% str2double(get(hObject,'String')) returns contents of edit_pid as a double
% --- Executes during object creation, after setting all properties.
function edit_pid_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit_pid (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'));
end
function edit_I_Callback(hObject, eventdata, handles)
% hObject handle to edit_I (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 edit_I as text
% str2double(get(hObject,'String')) returns contents of edit_I as a double
% --- Executes during object creation, after setting all properties.
function edit_I_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit_I (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'));
end
function edit_P_Callback(hObject, eventdata, handles)
% hObject handle to edit_P (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 edit_P as text
% str2double(get(hObject,'String')) returns contents of edit_P as a double
% --- Executes during object creation, after setting all properties.
function edit_P_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit_P (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'));
end
function edit_D_Callback(hObject, eventdata, handles)
% hObject handle to edit_D (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 edit_D as text
% str2double(get(hObject,'String')) returns contents of edit_D as a double
% --- Executes during object creation, after setting all properties.
function edit_D_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit_D (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'));
end
% --- Executes on button press in btn_pid.
function btn_pid_Callback(hObject, eventdata, handles)
[t,x,y]=sim('have_pid');
plot(t,y);
a=get_param('have_pid/Subsystem','Kp');
b=get_param('have_pid/Subsystem','Ki');
c=get_param('have_pid/Subsystem','Kd');
set(handles.edit_P,'string',a);
set(handles.edit_I,'string',b);
set(handles.edit_D,'string',c);
ym=max(y);
ys=y(length(t)) ;
n=1;
ys=y(length(t)) ;
n=1;
while y(n)<ys
n=n+1;end
tr=t(n)
set(handles.edit5,'string',tr); %上升时间
tp=spline(t,y,ym)
set(handles.edit6,'string',tp); %峰值时间
L=length(t);
while (y(L)>0.98*ys)&(y(L)<1.02*ys)
L=L-1;end
ts=t(L)
set(handles.edit7,'string',ts) %调节时间
ctl=(ym-ys)/ys*100;
set(handles.edit8,'string',ctl); %超调量
es=(ys-20)/20*100;
set(handles.edit9,'string',es); %稳态误差
% --- Executes on button press in btn_no_pid.
function btn_no_pid_Callback(hObject, eventdata, handles)
% hObject handle to btn_no_pid (see GCBO)
% eventdata rese
没有合适的资源?快使用搜索试试~ 我知道了~
水箱控制基于matlab GUI PID水箱控制系统【含Matlab源码 2099期】.zip

共7个文件
mdl:2个
m:2个
jpg:2个

1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉

温馨提示
CSDN海神之光上传的全部代码均可运行,亲测可用,尽我所能,为你服务; 1、代码压缩包内容 主函数:main.m; 调用函数:其他m文件;无需运行 运行结果效果图; 2、代码运行版本 Matlab 2019b;若运行有误,根据提示修改;若不会,可私信博主; 3、运行操作步骤 步骤一:将所有文件放到Matlab的当前文件夹中; 步骤二:双击打开main.m文件; 步骤三:点击运行,等程序运行完得到结果; 4、物理应用 仿真:导航、地震、电磁、电路、电能、机械、工业控制、水位控制、直流电机、平面电磁波、管道瞬变流 光学:光栅、杨氏双缝、单缝、多缝、圆孔、矩孔衍射、夫琅禾费、干涉、拉盖尔高斯、光束、光波、涡旋 定位问题:chan、taylor、RSSI、music、卡尔曼滤波UWB 气动学:弹道、气体扩散、龙格库弹道 运动学:倒立摆、泊车 天体学:卫星轨道、姿态
资源推荐
资源详情
资源评论

























收起资源包目录









共 7 条
- 1
资源评论

- 极光里的坐标.2024-04-15这个资源对我启发很大,受益匪浅,学到了很多,谢谢分享~
- wanshidaji6662024-05-10实在是宝藏资源、宝藏分享者!感谢大佬~


海神之光
- 粉丝: 6w+
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
