www.gusucode.com > fuzzy_featured 案例源码程序 matlab代码 > fuzzy_featured/fuzzytankdemo.m

    %% Water Level Control in a Tank
% This example shows how to use a fuzzy-logic inference system in a
% Simulink(R) model.

% Copyright 1990-2012 The MathWorks, Inc.

%% Required Product
% To run this example, Simulink(R) is required.
if ~fuzzychecktoolboxinstalled('simulink')
    disp('Simulink(R) is required to run this example.')
    return
end

%% Simulink Model
% There are two inputs to the fuzzy controller: the rate of change of the
% water level and the difference between the actual and the required water
% levels. The controller uses these inputs to manipulate the inflow rate.
open_system('sltankrule');

%% Simulation
% Simulate controller response with periodic changes in the setpoint of the
% water level. When you run the model, the Rule Viewer updates dynamically
% to show which rule the fuzzy controller is using to set the flow rate.
sim('sltankrule',100);

%%
bdclose('sltankrule');