模糊控制試驗_第1頁
模糊控制試驗_第2頁
模糊控制試驗_第3頁
模糊控制試驗_第4頁
模糊控制試驗_第5頁
已閱讀5頁,還剩13頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、F南大學(xué)模糊控制課程實驗報告彭雄威學(xué)生姓名: 指導(dǎo)教師:18 / 14院:信息科學(xué)與工程學(xué)院t=r.號 :1146111671.1所示。實驗一:本系統(tǒng)設(shè)計基于MATLAB圖形模糊推理系統(tǒng),設(shè)計步驟如下:打開MATLAB,輸入指令fuzzy,打開模糊邏輯工具箱的圖形用戶界面窗口,新建一 個Mamdani模糊推理系統(tǒng)。(1)增加一個輸入變量,將輸入變量命名為E、Ec,將輸出變量命名U。這樣就建立了一個兩輸入單輸出的模糊推理系統(tǒng)。如圖圖1.1增加一個輸入變量(2)設(shè)計模糊化模塊:設(shè)計隸屬度函數(shù)論域范圍寸 Be wb er ship Funct ion Edit or; fuz ziewbershij

2、) Funct ion Edit or; fuzzfJ Bewbership Funct ion Edit or; fuz圖3.2設(shè)計水位誤差E模塊3.3設(shè)計水位誤差Ec模塊圖3.4設(shè)計水位輸出U模塊(4)模糊控制器的規(guī)則設(shè)計> Rule Editoe: fuzzfPile E時itOptions2 IfCe is NG) a聞 Cec is NM) then (u is WB (1)3 If (fi is MeXrwJ Cec is NS) then (u is NM) (1)4 If Ce is we) a網(wǎng) Cec is Z theru is NMi) 0】 i.lfCe is N

3、B) srwi Cec is PS) then (w is NS) Cl) 6 If Ce is MB)也網(wǎng) Cec is PMD then ( is W(1) 7.ifCe is 血urtfA Cec is pB) then (u is Z)(1) S.lf Ce is Mvl) arT 佃c is MB) then (u is NB) (1>9. If e is M町 arid (ec is NM)thein (u is NM) 0)10. If (e is NM) and (ec is NS) then (u is NM)11. If (e is NM) and (ec is 2

4、then (u is NSj e isandec EThenu isNM NS ZPSPMrlMBNMNS ZPS PMrwk not notr CornectianWfeisht:O or© arwle = D3411 ITi*69晶1112131415Ifi17 IB ia 2D 21 22 旳 24Jb 26 2? je 29FIS 忖sme: fuzzf Melp Cl05e I1Delete ruleAdd rue I Change fuie (5)通過觀察器觀察規(guī)則情況在菜單view中的rules和surface選項分別對應(yīng)得是規(guī)則觀測器和曲面觀測器。Kil l p Vi

5、 ever = "FiiTTfFileu-0haut n QPlot pcintE:QU1比池 1 iFtT njhf jrjn'jvn| up Eh1 CIOS(6 I圖3.7規(guī)則觀測器? Suxrace Viewer: fuzzfPile E時itOptionsK (input)X grids:15R 亡f. Iriput:42-2-4=0-2e” Y (input):Y grids:ec15k Z (outputXEvaluateHsip Gloss M*R&a血圖3.6曲面觀測器(6)保存編輯好的FIS文件Save FIS保存在(X): I work&

6、 c? 1011 first, fiz I d iwi hlh bl llnnlll rwi II 百 gifuzif fii WBMimiBIHBIII HI IlTGizri f . £i s保存II*. £i a實驗二:利用 MATLAB 軟件的 M 文件編輯器和實驗一所生成的 fuzzf.FIS 文件,在 M 文件編輯器中輸入: a=readfis('fuzzf');evalfis(-0.5,-0.07;-0.5,0;-0.5,0.07; 0, -0.07;0,0;0,0.07;0.5,-0.07;0.5,0;0.5,0.07,a)便可得fuzzf.

7、FIS文件的模糊控制查詢表,其中的數(shù)據(jù)在水位誤差E的論域為-1 1,誤差變化EC的論域為-0.10.1 內(nèi)可以任意取值。a=readfis(' fuzzf ')name: ' fuzzf 'type: 'mamdani' andMethod: 'min'orMethod: 'max'defuzzMethod: 'Centroid'impMethod: 'min'aggMethod: 'max'input: 1x2 struCtoutput: 1x1 struCtrul

8、e: 1x5 struCt a=readfis(' fuzzf ');evalfis(-0.5,-0.07;-0.5,0;-0.5,0.07; 0, -0.07;0,0;0,0.07;0.5,-0.07;0.5,0;0.5,0.07,a) ans =-0.2000-0.4444-0.46670.1363-0.0014-0.22710.40000.44120.1333實驗三利用MATLAB軟件的M文件編輯器(也可選擇 C語言)完成模糊控制查詢表的計算。注意:全部工作都由程序?qū)崿F(xiàn),不利用FIS文件,不使用Fuzzy工具箱,包括模糊關(guān)系矩陣的求取及模糊推理、模糊判決。表1偏差E的賦值

9、表-6-5-4-3-2-10123456NB10.80.70.40.40.10000000NM0.20.710.70.300000000NS00.10.30.710.70.2000000NO00000.10.61000000P000000010.60.10000PS0000000.20.710.70.30.10PM000000000.20.710.70.3PB000000000.10.40.70.81表2偏差變化率EC的賦值表eceC-6-5-4-3-2-10123456NB10.70.30000000000NM0.30.710.70.300000000NS000.30.710.70.3000

10、000000000.30.710.70.30000PS0000000.30.710.70.300PM000000000.30.710.70.3PB00000000000.30.71表3推理語言規(guī)則表7NBNMNS0PSPMPBNBPBPBPBPBPM00NMPBPBPBPBPM00NSPMPMPMPM0NSNSNOPMPMPS0NSNMNMPOPMPMPS0NSNMNMPSPSPS0NMNMNMNMPM00NMNSNSNSNSPB00NMNSNSNSNS表4控制量U的賦值表U-6-5-4-3-2-10123456NB10.70.30000000000NM0.30.710.70.30000000

11、0NS000.30.710.70.3000000O00000.30.710.70.30000PS0000000.30.710.70.300PM000000000.30.710.70.3PB00000000000.30.71程序如下:cic;clear;E = 1,0.8,0.7,0.4,0.1,0,0,0,0,0,0,0,0;0.2,0.7,1,0.7,0.3,0,0,0,0,0,0,0,0;0,0.1,0.3,0.7,1,0.7,0.2,0,0,0,0,0,0;0,0,0,0,0.1,0.6,1,0,0,0,0,0,0;0,0,0,0,0,0,1,0.6,0.1,0,0,0,0;0,0,0,

12、0,0,0,0.2,0.7,1,0.7,0.3,0.1,0;0,0,0,0,0,0,0,0,020.7,1,0.7,0.3;0,0,0,0,0,0,0,0,0.1,0.4,0.7,0.8,1%8*13EC =1,0.7,0.3,0,0,0,0,0,0,0,0,0,0;0.3,0.7,1,0.7,0.3,0,0,0,0,0,0,0,0;0,0,0.3,0.7,1,0.7,0.3,0,0,0,0,0,0;0,0,0,0,0.3,0.7,1,0.7,0.3,0,0,0,0;0,0,0,0,0,0,0.3,0.7,1,0.7,0.3,0,0;0,0,0,0,0,0,0,0,0.3,0.7,1,0.7,

13、0.3;0,0,0,0,0,0,0,0,0,0,0.3,0.7,1%7*13U=1,0.7,0.3,0,0,0,0,0,0,0,0,0,0;0.3,0.7,1,0.7,0.3,0,0,0,0,0,0,0,0;0,0,0.3,0.7,1,0.7,0.3,0,0,0,0,0,0;0,0,0,0,0.3,0.7,1,0.7,0.3,0,0,0,0;0,0,0,0,0,0,0.3,0.7,1,0.7,0.3,0,0;0,0,0,0,0,0,0,0,0.3,0.7,1,0.7,0.3;0,0,0,0,0,0,0,0,0,0,0.3,0.7,1%7*13 rulelist= 1,1,1,1,2,4,4;1

14、,1,1,1,2,4,4;2,2,2,2,4,5,5;2,2,3,4,5,6,6;2,2,3,4,5,6,6;334,6,6,6,6;4,4,6,7,7,7,7;4,4,6,7,7,7,7%8*7for iii=1:13%偏差E的模糊值控制for jjj=1:13 for ii=1:8 for jj=1:7A_rulelist = rulelist(ii,jj); % 查模糊規(guī)則表 %* 計算 C1A'* A = E(ii,:);%取 A'C_A = U(A_rulelist,:);%取 Cifor i=1:13%求 R1Afor j=1:13 if(A(i) > C_A

15、(1,j) Ra(i,j) = C_A(1,j);%偏差率EC的模糊值控制%偏差E的模糊規(guī)則控制%偏差變化率EC的模糊規(guī)則控制elseRa(i,j) = A(i);endendendAA = zeros(1,13); %取 AA=A' 如 AA=1,0,0,0,0,0,0,0,0,0,0,0,0; %AA(1,iii) = E(ii,iii);AA(1,iii) = 1;for i=1:13 for j=1:13%先取小if(AA(j) > Ra(j,i) A_qux(j,i) = Ra(j,i);elseA_qux(j,i) = AA(j);endendendendfor i=

16、1:13max = A_qux(1,i);for j=1:13if(max <A_qux(j,i) max = A_qux(j,i); end%再取大,求和 CiAend CiA(i) = max;%*CiA%* 計算B = EC(jj,:);C_B = U(A_rulelist,:);計算完畢 *CiB'*%取 B'?%取 Ci?for i=1:13%求 R1Bfor j=1:13if(B(1,i) > C_B(1,j)elseend endendRb(i,j) = C_B(1,j);Rb(i,j) = B(1,i);BB = zeros(1,13); %取 BB

17、=B' 如 BB=1,0,0,0,0,0,0,0,0,0,0,0,0; %BB(1,jjj) = EC(jj,jjj);BB(1,jjj) = 1;for i=1:13 for j=1:13%先取小if(BB(j) >Rb(j,i) B_qux(j,i) = Rb(j,i);elseB_qux(j,i) = BB(j);endendendendfor i=1:13max = B_qux(1,i); for j=1:13 if(max <B_qux(j,i)max = B_qux(j,i); end end CiB(i) = max;%再取大,求和 CiA%* 計算 CiB&

18、#39;完畢 *%* 計算 C1'=CiA'交 CiB'* for i=1:13if CiA(i) >CiB(i)Ci(i) = CiB(i);elseCi(i) = CiA(i);endendend%* 算 C1'完畢 *C(ii-1)*7+jj,:) = Ci; % 將 Ci 存到數(shù)組 C 中,C是 56*13 的數(shù)組end%根據(jù)式Ui=C'=C1'并C2'并 for i=1:13 max = C(1,i);for j=1:56并 3'if(max < C(j,i)max = C(j,i);endendUi(i)

19、= max;end%用重心法進行解模糊運算,并映射為實際的控制量 sum_fe nz = 0;sum_fe nm = 0;for i=1:13sum_fe nz = sum_fe nz + (i-7)*Ui(i);sum_fe nm = sum_fe nm + Ui(i);endcore = sum_fe nz/sum_fe nm;U_c on trol(iii,jjj) = core;end endroun d(U_co ntrol.*10000)/10000;%對控制量保留小數(shù)點后兩位U_con trol =U_c on trol 計算結(jié)果:U control =jyju-b. 2 泊,-

20、b.JfcUU-b.-b.JbJU-b.JJSJ-4.-U. Mb創(chuàng)-N 11 JT. JUUUjQ-SlOMO-s.orco-4.舸 W-D.C050-t附劃-ISS?-3.3571-1.T9F50.2414-4-保 3-4. b21?-4世衛(wèi)3-4.bai/-4.t.!?23-ZSJ2-l.S3rb-1.1211-t.fcy?bO.tJliiu.tsda-d. ssai-d.疋自IT一址飢-4.2581-4.2551-i. 25-2.9302-2. i9t9-l.d211-0.335-o 一制附1.tD03I. CQOCl-4.umo-4.ULOQ-3.?686-3.47 陽一乳5羽-2.4318-1. TAS'b-0. 44(0-0.13ei4C.lfiOJj.eooji.esie-Q+ OCdQ7+范汕-3h0769-2h i65?-E* IL

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論