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

    %% Temperature Control in a Shower
% 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 water temperature and
% the flow rate. The controller uses these inputs to manipulate the hot and
% cold valves.
open_system('shower');

%% Simulation
% Simulate controller response with periodic changes in the setpoints of
% the water temperature and flow rate.
set_param('shower/flow scope','Open','on','Ymin','0','Ymax','1');
set_param('shower/temp scope','Open','on','Ymin','15','Ymax','30');
sim('shower',50);

%%
bdclose('shower');