① matlab仿真求调整PID参数
直接使用CFTOOL工具箱
命令行输入cftool即可,然后选择拟合类型
x=[6.69:0.02:7.53];
y=[4.2,3.7,3.3,2.95,2.63,2.33,2.11,1.87,1.65,1.47,1.32,1.17,1.04,0.925,0.82,0.735,0.653,0.582,0.52,0.462,0.412,0.366,0.325,0.289,0.258,0.23,0.205,0.182,0.162,0.145,0.129,0.115,0.102,0.091,0.081,0.072,0.064,0.057,0.051,0.0455,0.0403,0.036,0.032];
直接输入cftool进入曲线拟合工具箱界面“Curve Fitting tool”
(1)点击“Data”按钮,弹出“Data”窗口;
(2)利用X data和Y data的下拉菜单读入数据x,y,然后点击“Create data set”按钮,退出“Data”窗口,返回工具箱界面,这时会自动画出数据集的曲线图;
(3)点击“Fitting”按钮,弹出“Fitting”窗口;
(4)点击“New fit”按钮,可修改拟合项目名称“Fit name”,通过“Data set”下拉菜单选择数据集,然后通过下拉菜单“Type of fit”选择拟合曲线的类型,选择类型Power:幂逼近,有2种类型,a*x^b 、a*x^b + c
② 濡備綍鐢╩atlab瀹炵幇涓嬪垪妯″瀷鐨刾id鎺у埗锛
瑕佸湪MATLAB涓瀹炵幇璇ユā鍨嬬殑PID鎺у埗锛岄栧厛闇瑕佹牴鎹鎵缁欑殑琚鎺у硅薄妯″瀷寤虹珛涓涓绂绘暎鏃堕棿妯″瀷锛岀劧鍚庣敤PID鎺у埗鍣ㄨ繘琛屾帶鍒躲備互涓嬫槸涓涓绠鍗曠殑瀹炵幇锛
棣栧厛锛屽畾涔夋ā鍨嬪弬鏁板拰PID鎺у埗鍣ㄥ弬鏁帮細
% 妯″瀷鍙傛暟
T = 0.1; % 閲囨牱鏃堕棿锛堢掞級
N = 100; % 浠跨湡姝ユ暟
% PID鎺у埗鍣ㄥ弬鏁
Kp = 1; % 姣斾緥澧炵泭
Ki = 1; % 绉鍒嗗炵泭
Kd = 1; % 寰鍒嗗炵泭
鍒濆嬪寲妯″瀷鍙橀噺鍜屾帶鍒跺櫒鍙橀噺锛
% 鍒濆嬪寲鍙橀噺
y = zeros(1, N);
u = zeros(1, N);
a = zeros(1, N);
e = zeros(1, N);
ie = zeros(1, N);
de = zeros(1, N);
% 璁惧畾鐩鏍囪緭鍑
target = 1;
浣跨敤寰鐜瀹炵幇绂绘暎鏃堕棿妯″瀷鍜孭ID鎺у埗鍣锛
for k = 2:N
% 璁$畻a(k)
a(k) = 1.2 * (1 - 0.8 * exp(-0.1 * k));
% 妯″瀷鏂圭▼
y(k) = a(k) * y(k - 1) / (1 + y(k - 1)^2) + u(k - 1);
% 璁$畻璇宸
e(k) = target - y(k);
% 绉鍒嗚宸
ie(k) = ie(k - 1) + e(k) * T;
% 寰鍒嗚宸
de(k) = (e(k) - e(k - 1)) / T;
% PID鎺у埗鍣
u(k) = Kp * e(k) + Ki * ie(k) + Kd * de(k);
end
鐢诲嚭杈撳嚭鏇茬嚎鍜屾帶鍒惰緭鍏ユ洸绾匡細
figure;
subplot(2, 1, 1);
plot(1:N, y, 'LineWidth', 1.5);
xlabel('Time step (k)');
ylabel('Output (y)');
title('System Output');
subplot(2, 1, 2);
plot(1:N, u, 'LineWidth', 1.5);
xlabel('Time step (k)');
ylabel('Control Input (u)');
title('Control Input');
杩欐牱灏卞疄鐜颁簡鍩轰簬缁欏畾妯″瀷鐨凱ID鎺у埗銆傞渶瑕佹敞鎰忕殑鏄锛岃繖閲岀殑PID鎺у埗鍣ㄥ弬鏁帮紙Kp銆並i銆並d锛夊彲鑳介渶瑕佹牴鎹鍏蜂綋绯荤粺杩涜岃皟鏁翠互鑾峰緱鏈浣虫帶鍒舵ц兘銆備綘鍙浠ュ皾璇曚娇鐢∕ATLAB鐨勬帶鍒剁郴缁熷伐鍏风变腑鐨凱ID璋冭妭鍣ㄦ潵璋冩暣杩欎簺鍙傛暟銆
③ labview2010 pid工具包如何激活求高手指教,有注册机PID.and.Fuzzy.Logic.Toolkit-TBE-keygen的最好
在注册机中找到对应的工具包,右键点击,然后activate,见下图