① 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,見下圖