Using MATLAB to generate an offline query table for fuzzy control

Source: Internet
Author: User

1. Open the Fuzzy Control Toolbox, edit the Membership function and fuzzy control rules for the input and output variables, as shown in export as Fuzzy_control.fis file.

2. Open the Simulink module, establish the system diagram shown, two inputs, one output, the processing module is the fuzzy Logic controller with ruleviewer (or fuzzy logic controller).

3. Enter Fuzzy=readfis (' Fuzzy_control ') in the MATLAB window command to load the previously established fuzzy controller into the working space, set the parameters of the Fuzzy control module in Simulink to Fuzzy, save the model, and generate Fuzzy_ Model.mdl.

4.start->matlab->more->systemtest, open the test interface, check main test, menu bar, test Element, Simulink, Select the model Fuzzy_model established in the second step.

5. Variable definition. In Test Vectors, define two test vectors, the variable names are INPUT1 and Input2 respectively, edit the range of two variables, define the test variables in testing Variables, and the variable name is output.

6. Variable mappings. The test vectors input1 and input2 are mapped to the input port in1 and in2 of the fuzzy controller respectively, as input test signals. The output of the test variable is mapped to the Fuzzy controller outlet OUT1. The interface after Setup is shown in the two figure below.

6.Save Results, as shown in.

7. Save and Test.

8. Result format conversion

    • System test results are saved in stresults. In Resultsdataset.output, an array of cells for the 169*1 cell (if the output of two variables has a sequence of 13 values). (Note: unit cell is a [n*1 double] structure, indicating that the system has been tested N times.) )
    • Under the MATLAB command window, enter Test_data = Stresults. Resultsdataset.output, the test result exists in the variable test_data.

%Import the Blur controller%fuzzy=readfis ('Fuzzy_20150323.fis'); %Run Test%Copy the following code to command window to run Test_data=Stresults. Resultsdataset.output; A=zeros (121,1);  forI=1:121b=Test_data{i}; A (i)=b (1); End C=reshape (A, One, One); Table_data=c';%Save to TXT file%d=table_data.*10000; %dlmwrite ('Fuzzy.txt'D'Precision','%.0f','NewLine','PC')

Resources:

    1. How to use MATLAB to transform fuzzy logic into a query table
    2. Use of MATLAB fuzzy Toolbox
    3. Simple Matlab/simulink Fuzzy Controller application Example-figure
    4. How to transform the fuzzy inference system into a query table (original) under Matlab
    5. Detailed steps for fuzzy pid Matlab (Simulink) simulation
    6. The installation method of fuzzy controller under MATLAB

Using MATLAB to generate an offline query table for fuzzy control

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.