From: <lm...@us...> - 2011-09-01 15:12:41
|
Revision: 8484 http://octave.svn.sourceforge.net/octave/?rev=8484&view=rev Author: lmarkov Date: 2011-09-01 15:12:29 +0000 (Thu, 01 Sep 2011) Log Message: ----------- M fuzzy-logic-toolkit/DESCRIPTION M fuzzy-logic-toolkit/ChangeLog M fuzzy-logic-toolkit/INDEX A fuzzy-logic-toolkit/inst/linear_tip_calculator.fis M fuzzy-logic-toolkit/inst/mamdani_tip_demo.m M fuzzy-logic-toolkit/inst/writefis.m D fuzzy-logic-toolkit/inst/cubic-approximator.fis M fuzzy-logic-toolkit/inst/addvar.m D fuzzy-logic-toolkit/inst/sugeno-tip-calculator.fis M fuzzy-logic-toolkit/inst/showrule.m M fuzzy-logic-toolkit/inst/gensurf.m D fuzzy-logic-toolkit/inst/showrule_demo.m A fuzzy-logic-toolkit/inst/heart_disease_risk.fis D fuzzy-logic-toolkit/inst/addmf_demo.m A fuzzy-logic-toolkit/inst/mamdani_tip_calculator.fis M fuzzy-logic-toolkit/inst/sugeno_tip_demo.m D fuzzy-logic-toolkit/inst/linear-tip-calculator.fis M fuzzy-logic-toolkit/inst/getfis.m M fuzzy-logic-toolkit/inst/cubic_approx_demo.m M fuzzy-logic-toolkit/inst/heart_demo_1.m M fuzzy-logic-toolkit/inst/heart_demo_2.m M fuzzy-logic-toolkit/inst/linear_tip_demo.m M fuzzy-logic-toolkit/inst/newfis.m M fuzzy-logic-toolkit/inst/setfis.m D fuzzy-logic-toolkit/inst/addvar_demo.m D fuzzy-logic-toolkit/inst/heart-disease-risk.fis A fuzzy-logic-toolkit/inst/sugeno_tip_calculator.fis M fuzzy-logic-toolkit/inst/addmf.m D fuzzy-logic-toolkit/inst/mamdani-tip-calculator.fis M fuzzy-logic-toolkit/inst/readfis.m M fuzzy-logic-toolkit/inst/private/defuzzify_output_mamdani.m M fuzzy-logic-toolkit/inst/private/is_grid_spec.m M fuzzy-logic-toolkit/inst/private/eval_firing_strength.m M fuzzy-logic-toolkit/inst/private/eval_rules_sugeno.m M fuzzy-logic-toolkit/inst/private/eval_rules_mamdani.m A fuzzy-logic-toolkit/inst/private/is_real.m M fuzzy-logic-toolkit/inst/private/defuzzify_output_sugeno.m A fuzzy-logic-toolkit/inst/cubic_approximator.fis Modified Paths: -------------- trunk/octave-forge/main/fuzzy-logic-toolkit/ChangeLog trunk/octave-forge/main/fuzzy-logic-toolkit/DESCRIPTION trunk/octave-forge/main/fuzzy-logic-toolkit/INDEX trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addmf.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addvar.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/cubic_approx_demo.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/gensurf.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/getfis.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart_demo_1.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart_demo_2.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/linear_tip_demo.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/mamdani_tip_demo.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/newfis.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/defuzzify_output_mamdani.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/defuzzify_output_sugeno.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/eval_firing_strength.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/eval_rules_mamdani.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/eval_rules_sugeno.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_grid_spec.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/readfis.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/setfis.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/showrule.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/sugeno_tip_demo.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/writefis.m Added Paths: ----------- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/cubic_approximator.fis trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart_disease_risk.fis trunk/octave-forge/main/fuzzy-logic-toolkit/inst/linear_tip_calculator.fis trunk/octave-forge/main/fuzzy-logic-toolkit/inst/mamdani_tip_calculator.fis trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_real.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/sugeno_tip_calculator.fis Removed Paths: ------------- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addmf_demo.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addvar_demo.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/cubic-approximator.fis trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart-disease-risk.fis trunk/octave-forge/main/fuzzy-logic-toolkit/inst/linear-tip-calculator.fis trunk/octave-forge/main/fuzzy-logic-toolkit/inst/mamdani-tip-calculator.fis trunk/octave-forge/main/fuzzy-logic-toolkit/inst/showrule_demo.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/sugeno-tip-calculator.fis Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/ChangeLog =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/ChangeLog 2011-09-01 11:37:55 UTC (rev 8483) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/ChangeLog 2011-09-01 15:12:29 UTC (rev 8484) @@ -1,55 +1,103 @@ +2011-09-01 Version 0.2.4 + + * ChangeLog: Updated file. + * DESCRIPTION: Updated file. + * INDEX: Updated file. + * inst/*.m: Numerous trivial changes. + * inst/addmf_demo.m: Merged into addmf.m as an embedded demo + and then removed. + * inst/addvar_demo.m: Merged into addvar.m as an embedded demo + and then removed. + * inst/showrule_demo.m: Merged into showrule.m as four embedded + demos and then removed. + * inst/gensurf.m: Edited to permit scalar grids argument. + * inst/getfis.m: Edited to implement "version" field in the FIS. + * inst/newfis.m: Edited to implement "version" field in the FIS. + * inst/readfis.m: Edited to implement "version" field in the FIS + and to handle comments, whitespace, and variable number of + membership function parameters. + * inst/setfis.m: Edited to implement "version" field in the FIS. + Fixed several bugs. + * inst/writefis.m: Edited to implement "version" field in the FIS. + * inst/cubic_approximator.fis: Renamed cubic-approximator.fis. + * inst/heart_disease_risk.fis: Renamed heart-disease-risk.fis. + Added comments and whitespace. + * inst/linear_tip_calculator.fis: Renamed linear-tip-calculator.fis. + * inst/mamdani_tip_calculator.fis: Renamed mamdani-tip-calculator.fis + and edited to have multiple outputs. + * inst/mamdani_tip_demo.m: Edited to demonstrate multiple outputs. + * inst/sugeno_tip_calculator.fis: Renamed sugeno-tip-calculator.fis + and edited to have multiple outputs. + * inst/sugeno_tip_demo.m: Edited to demonstrate multiple outputs. + * inst/private/defuzzify_output_mamdani.m: Bug fix (to handle an FIS + with multiple outputs). + * inst/private/defuzzify_output_sugeno.m: Bug fix (to handle an FIS + with multiple outputs). + * inst/private/eval_firing_strength.m: Bug fix. + * inst/private/eval_rules_mamdani.m: Bug fix (to handle an FIS with + multiple outputs). + * inst/private/eval_rules_sugeno.m: Bug fix (to handle an FIS with + multiple outputs). + * inst/private/is_grid_spec.m: Edited test to make more efficient. + * inst/private/is_real.m: New file. + * Demos tested under: Fedora 15/Octave 3.4.2 + * Demos tested under: Fedora 15/Octave 3.2.4 + 2011-07-19 Version 0.2.3 - * ChangeLog: Updated file. - * DESCRIPTION: Updated file. - * INDEX: Updated file. - * inst/*.m: Edited numerous comments and texinfo comment blocks. - * inst/private/*.m: Edited numerous comments and texinfo comment blocks. - * inst/cubic_approx_demo.m: New file. - * inst/cubic-approximator.fis: New file. - * inst/linear-tip-calculator.fis: New file. - * inst/linear_tip_demo.m: New file. - * inst/heart_demo_1.m: Renamed commandline_demo.m. - * inst/heart_demo_2.m: Renamed heart_demo.m. - * inst/mamdani_tip_demo.m: Renamed mamdani_demo.m. - * inst/sugeno_tip_demo.m: Renamed tipping_demo.m. - * inst/gensurf.m: Edited to handle 2-dimensional plots. - * inst/private/eval_rules_sugeno.m: Edited to handle linear output membership functions. - * Demos tested under: Fedora 15/Octave 3.4.0 - * Demos tested under: Fedora 15/Octave 3.2.4 + * ChangeLog: Updated file. + * DESCRIPTION: Updated file. + * INDEX: Updated file. + * inst/*.m: Edited numerous comments and texinfo comment blocks. + * inst/private/*.m: Edited numerous comments and texinfo comment blocks. + * inst/cubic_approx_demo.m: New file. + * inst/cubic-approximator.fis: New file. + * inst/linear-tip-calculator.fis: New file. + * inst/linear_tip_demo.m: New file. + * inst/heart_demo_1.m: Renamed commandline_demo.m. + * inst/heart_demo_2.m: Renamed heart_demo.m. + * inst/mamdani_tip_demo.m: Renamed mamdani_demo.m. + * inst/sugeno_tip_demo.m: Renamed tipping_demo.m. + * inst/gensurf.m: Edited to handle 2-dimensional plots. + * inst/private/eval_rules_sugeno.m: Edited to handle linear output + membership functions. + * Demos tested under: Fedora 15/Octave 3.4.0 + * Demos tested under: Fedora 15/Octave 3.2.4 2011-06-21 Version 0.2.2 - * ChangeLog: New file. - * DESCRIPTION: Updated file. - * inst/addmf.m: Modified to workaround a bug in Octave 3.4.0. - * inst/addrule.m: Modified to workaround a bug in Octave 3.4.0. - * inst/addvar.m: Modified to workaround a bug in Octave 3.4.0. - * inst/gaussmf.m: Modified demo and texinfo comment string. - * inst/getfis.m: Modified to workaround a bug in Octave 3.4.0. - * inst/readfis.m: Modified to workaround a bug in Octave 3.4.0. - * inst/private/aggregate_output_mamdani.m: Modified to workaround a bug in Octave 3.4.0. - * inst/private/evalmf_private.m: Modified to workaround a bug in Octave 3.4.0. - * Demos tested under: Fedora 15/Octave 3.4.0 - * Demos tested under: Fedora 15/Octave 3.2.4 + * ChangeLog: New file. + * DESCRIPTION: Updated file. + * inst/addmf.m: Modified to workaround a bug in Octave 3.4.0. + * inst/addrule.m: Modified to workaround a bug in Octave 3.4.0. + * inst/addvar.m: Modified to workaround a bug in Octave 3.4.0. + * inst/gaussmf.m: Modified demo and texinfo comment string. + * inst/getfis.m: Modified to workaround a bug in Octave 3.4.0. + * inst/readfis.m: Modified to workaround a bug in Octave 3.4.0. + * inst/private/aggregate_output_mamdani.m: Modified to workaround + a bug in Octave 3.4.0. + * inst/private/evalmf_private.m: Modified to workaround a bug in + Octave 3.4.0. + * Demos tested under: Fedora 15/Octave 3.4.0 + * Demos tested under: Fedora 15/Octave 3.2.4 2011-06-08 Version 0.2.1 - * Initial release on Octave-Forge. - * Merged membership function demos into related function files. - * Created documentation for Octave-Forge website. - * DESCRIPTION: Updated file. - * Demos tested under: Fedora 13/Octave 3.2.4 + * Initial release on Octave-Forge. + * Merged membership function demos into related function files. + * Created documentation for Octave-Forge website. + * DESCRIPTION: Updated file. + * Demos tested under: Fedora 13/Octave 3.2.4 2011-05-25 Version 0.2 - * Moved tests/demos/* and tests/fis/* to inst/*. - * Changed indentation and spacing to conform to Octave style. - * Converted comments to texinfo. - * DESCRIPTION: Update file. - * Demos tested under: Fedora 13/Octave 3.2.4 + * Moved tests/demos/* and tests/fis/* to inst/*. + * Changed indentation and spacing to conform to Octave style. + * Converted comments to texinfo. + * DESCRIPTION: Update file. + * Demos tested under: Fedora 13/Octave 3.2.4 2011-04-19 Version 0.1 - * Initial release on SourceForge. - * Demos tested under: Fedora 13/Octave 3.2.4 + * Initial release on SourceForge. + * Demos tested under: Fedora 13/Octave 3.2.4 Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/DESCRIPTION =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/DESCRIPTION 2011-09-01 11:37:55 UTC (rev 8483) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/DESCRIPTION 2011-09-01 15:12:29 UTC (rev 8484) @@ -1,6 +1,6 @@ Name: fuzzy-logic-toolkit -Version: 0.2.3 -Date: 2011-7-19 +Version: 0.2.4 +Date: 2011-09-01 Author: L. Markowsky <lm...@us...> Maintainer: L. Markowsky <lm...@us...> Title: Octave Fuzzy Logic Toolkit Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/INDEX =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/INDEX 2011-09-01 11:37:55 UTC (rev 8483) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/INDEX 2011-09-01 15:12:29 UTC (rev 8484) @@ -27,7 +27,7 @@ showfis showrule -Membership Functions (with Demos) +Membership Functions dsigmf gauss2mf gaussmf @@ -40,14 +40,11 @@ trimf zmf -Fuzzy Inference System Demos - addmf_demo - addvar_demo +Complete Fuzzy Inference System Demos cubic_approx_demo heart_demo_1 heart_demo_2 linear_tip_demo mamdani_tip_demo - showrule_demo sugeno_tip_demo Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addmf.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addmf.m 2011-09-01 11:37:55 UTC (rev 8483) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addmf.m 2011-09-01 15:12:29 UTC (rev 8484) @@ -50,53 +50,22 @@ ## structure outputs or to Sugeno-type FIS structures, and the result of using ## them for FIS inputs or Mamdani-type FIS outputs has not yet been tested. ## -## For example, the following code produces two figures, each showing a term -## set for one of the FIS input variables: -## -## @example -## @group -## ## Create new FIS. -## a = newfis ('Heart-Disease-Risk', 'sugeno', ... -## 'min', 'max', 'min', 'max', 'wtaver'); -## -## ## Add two inputs and their membership functions. -## a = addvar (a, 'input', 'LDL-Level', [0 300]); -## a = addmf (a, 'input', 1, 'Low', 'trapmf', ... -## [-1 0 90 110]); -## a = addmf (a, 'input', 1, 'Low-Borderline', 'trapmf', ... -## [90 110 120 140]); -## a = addmf (a, 'input', 1, 'Borderline', 'trapmf', ... -## [120 140 150 170]); -## a = addmf (a, 'input', 1, 'High-Borderline', 'trapmf', ... -## [150 170 180 200]); -## a = addmf (a, 'input', 1, 'High', 'trapmf', ... -## [180 200 300 301]); -## -## a = addvar (a, 'input', 'HDL-Level', [0 100]); -## a = addmf (a, 'input', 2, 'Low-HDL', 'trapmf', ... -## [-1 0 35 45]); -## a = addmf (a, 'input', 2, 'Moderate-HDL', 'trapmf', ... -## [35 45 55 65]); -## a = addmf (a, 'input', 2, 'High-HDL', 'trapmf', ... -## [55 65 100 101]); -## -## ## Plot the input membership functions. -## plotmf (a, 'input', 1); -## plotmf (a, 'input', 2); -## @end group -## @end example -## ## @noindent -## To run this code, type @t{addmf_demo} at the Octave prompt. +## To run the demonstration code below, type @t{demo('addmf')} at the +## Octave prompt. This demo creates two FIS input variables and associated +## membership functions and then produces two figures showing the term +## sets for the two FIS inputs. ## -## @seealso{addmf_demo, rmmf, setfis} +## @seealso{rmmf, setfis} ## @end deftypefn ## Author: L. Markowsky ## Keywords: fuzzy-logic-toolkit fuzzy membership-function membership ## Directory: fuzzy-logic-toolkit/inst/ ## Filename: addmf.m -## Last-Modified: 16 Jul 2011 +## Note: The demo code is based on an assignment written by +## Dr. Bruce Segee (University of Maine Dept. of ECE). +## Last-Modified: 30 Aug 2011 function fis = addmf (fis, in_or_out, var_index, mf_name, mf_type, mf_params) @@ -142,3 +111,25 @@ endif endfunction + +%!demo +%! ## Create new FIS. +%! a = newfis ('Heart-Disease-Risk', 'sugeno', ... +%! 'min', 'max', 'min', 'max', 'wtaver'); +%! +%! ## Add two inputs and their membership functions. +%! a = addvar (a, 'input', 'LDL-Level', [0 300]); +%! a = addmf (a, 'input', 1, 'Low', 'trapmf', [-1 0 90 110]); +%! a = addmf (a, 'input', 1, 'Low-Borderline', 'trapmf', [90 110 120 140]); +%! a = addmf (a, 'input', 1, 'Borderline', 'trapmf', [120 140 150 170]); +%! a = addmf (a, 'input', 1, 'High-Borderline', 'trapmf', [150 170 180 200]); +%! a = addmf (a, 'input', 1, 'High', 'trapmf', [180 200 300 301]); +%! +%! a = addvar (a, 'input', 'HDL-Level', [0 100]); +%! a = addmf (a, 'input', 2, 'Low-HDL', 'trapmf', [-1 0 35 45]); +%! a = addmf (a, 'input', 2, 'Moderate-HDL', 'trapmf', [35 45 55 65]); +%! a = addmf (a, 'input', 2, 'High-HDL', 'trapmf', [55 65 100 101]); +%! +%! ## Plot the input membership functions. +%! plotmf (a, 'input', 1); +%! plotmf (a, 'input', 2); Deleted: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addmf_demo.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addmf_demo.m 2011-09-01 11:37:55 UTC (rev 8483) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addmf_demo.m 2011-09-01 15:12:29 UTC (rev 8484) @@ -1,55 +0,0 @@ -## Copyright (C) 2011 L. Markowsky <lm...@us...> -## -## This file is part of the fuzzy-logic-toolkit. -## -## The fuzzy-logic-toolkit is free software; you can redistribute it -## and/or modify it under the terms of the GNU General Public License -## as published by the Free Software Foundation; either version 3 of -## the License, or (at your option) any later version. -## -## The fuzzy-logic-toolkit is distributed in the hope that it will be -## useful, but WITHOUT ANY WARRANTY; without even the implied warranty -## of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with the fuzzy-logic-toolkit; see the file COPYING. If not, -## see <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {Script File} {} addmf_demo -## -## Demonstrate the function @t{addmf} by executing the code -## given in the comment at the top of addmf.m. -## -## @seealso{addmf, heart_demo_1} -## @end deftypefn - -## Author: L. Markowsky -## Note: This example is based on an assignment written by -## Dr. Bruce Segee (University of Maine Dept. of ECE). -## Keywords: fuzzy-logic-toolkit fuzzy tests demos -## Directory: fuzzy-logic-toolkit/inst -## Filename: addmf_demo.m -## Last-Modified: 16 Jul 2011 - -## Create new FIS. -a = newfis ('Heart-Disease-Risk', 'sugeno', ... - 'min', 'max', 'min', 'max', 'wtaver'); - -## Add two inputs and their membership functions. -a = addvar (a, 'input', 'LDL-Level', [0 300]); -a = addmf (a, 'input', 1, 'Low', 'trapmf', [-1 0 90 110]); -a = addmf (a, 'input', 1, 'Low-Borderline', 'trapmf', [90 110 120 140]); -a = addmf (a, 'input', 1, 'Borderline', 'trapmf', [120 140 150 170]); -a = addmf (a, 'input', 1, 'High-Borderline', 'trapmf', [150 170 180 200]); -a = addmf (a, 'input', 1, 'High', 'trapmf', [180 200 300 301]); - -a = addvar (a, 'input', 'HDL-Level', [0 100]); -a = addmf (a, 'input', 2, 'Low-HDL', 'trapmf', [-1 0 35 45]); -a = addmf (a, 'input', 2, 'Moderate-HDL', 'trapmf', [35 45 55 65]); -a = addmf (a, 'input', 2, 'High-HDL', 'trapmf', [55 65 100 101]); - -## Plot the input membership functions. -plotmf (a, 'input', 1); -plotmf (a, 'input', 2); Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addvar.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addvar.m 2011-09-01 11:37:55 UTC (rev 8483) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addvar.m 2011-09-01 15:12:29 UTC (rev 8484) @@ -37,31 +37,17 @@ ## The vector components x1 and x2, which must also satisfy x1 <= x2, ## specify the lower and upper bounds of the variable's domain. ## -## For example: -## @example -## @group -## a = newfis('Heart-Disease-Risk', 'sugeno', ... -## 'min', 'max', 'min', 'max', 'wtaver'); -## a = addvar(a, 'input', 'LDL-Level', [0 300]); -## getfis(a, 'input', 1); -## ==> Name = LDL_Level -## NumMFs = 0 -## MFLabels = -## Range = [0 300] -## @end group -## @end example -## ## @noindent -## To run this code, type @t{addvar_demo} at the Octave prompt. +## To run the demonstration code below, type @t{demo('addvar')} at the +## Octave prompt. ## -## @seealso{addvar_demo} ## @end deftypefn ## Author: L. Markowsky ## Keywords: fuzzy-logic-toolkit fuzzy variable ## Directory: fuzzy-logic-toolkit/inst/ ## Filename: addvar.m -## Last-Modified: 16 Jul 2011 +## Last-Modified: 30 Aug 2011 function fis = addvar (fis, in_or_out, var_name, var_range) @@ -105,3 +91,9 @@ endif endfunction + +%!demo +%! a = newfis ('Heart-Disease-Risk', 'sugeno', ... +%! 'min', 'max', 'min', 'max', 'wtaver'); +%! a = addvar (a, 'input', 'LDL-Level', [0 300]); +%! getfis (a, 'input', 1); Deleted: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addvar_demo.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addvar_demo.m 2011-09-01 11:37:55 UTC (rev 8483) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addvar_demo.m 2011-09-01 15:12:29 UTC (rev 8484) @@ -1,37 +0,0 @@ -## Copyright (C) 2011 L. Markowsky <lm...@us...> -## -## This file is part of the fuzzy-logic-toolkit. -## -## The fuzzy-logic-toolkit is free software; you can redistribute it -## and/or modify it under the terms of the GNU General Public License -## as published by the Free Software Foundation; either version 3 of -## the License, or (at your option) any later version. -## -## The fuzzy-logic-toolkit is distributed in the hope that it will be -## useful, but WITHOUT ANY WARRANTY; without even the implied warranty -## of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with the fuzzy-logic-toolkit; see the file COPYING. If not, -## see <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {Script File} {} addvar_demo -## -## Demonstrate the function @t{addvar} by executing the code given in the -## comment at the top of addvar.m. -## -## @seealso{addvar, heart_demo_1} -## @end deftypefn - -## Author: L. Markowsky -## Keywords: fuzzy-logic-toolkit fuzzy tests demos -## Directory: fuzzy-logic-toolkit/inst -## Filename: addvar_demo.m -## Last-Modified: 16 Jul 2011 - -a = newfis ('Heart-Disease-Risk', 'sugeno', ... - 'min', 'max', 'min', 'max', 'wtaver'); -a = addvar (a, 'input', 'LDL-Level', [0 300]); -getfis (a, 'input', 1); Deleted: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/cubic-approximator.fis =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/cubic-approximator.fis 2011-09-01 11:37:55 UTC (rev 8483) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/cubic-approximator.fis 2011-09-01 15:12:29 UTC (rev 8484) @@ -1,57 +0,0 @@ -[System] -Name='Cubic-Approximator' -Type='sugeno' -Version=2.0 -NumInputs=1 -NumOutputs=1 -NumRules=11 -AndMethod='min' -OrMethod='max' -ImpMethod='min' -AggMethod='max' -DefuzzMethod='wtaver' - -[Input1] -Name='X' -Range=[-5 5] -NumMFs=11 -MF1 = 'About-Neg-Five':'trimf', [-6 -5 -4] -MF2 = 'About-Neg-Four':'trimf', [-5 -4 -3] -MF3 = 'About-Neg-Three':'trimf', [-4 -3 -2] -MF4 = 'About-Neg-Two':'trimf', [-3 -2 -1] -MF5 = 'About-Neg-One':'trimf', [-2 -1 0] -MF6 = 'About-Zero':'trimf', [-1 0 1] -MF7 = 'About-One':'trimf', [0 1 2] -MF8 = 'About-Two':'trimf', [1 2 3] -MF9 = 'About-Three':'trimf', [2 3 4] -MF10 = 'About-Four':'trimf', [3 4 5] -MF11 = 'About-Five':'trimf', [4 5 6] - -[Output1] -Name='Approx-X-Cubed' -Range=[-130 130] -NumMFs=11 -MF1 = 'Tangent-at-Neg-Five':'linear', [75 250] -MF2 = 'Tangent-at-Neg-Four':'linear', [48 128] -MF3 = 'Tangent-at-Neg-Three':'linear', [27 54] -MF4 = 'Tangent-at-Neg-Two':'linear', [12 16] -MF5 = 'Tangent-at-Neg-One':'linear', [3 2] -MF6 = 'Tangent-at-Zero':'linear', [0 0] -MF7 = 'Tangent-at-One':'linear', [3 -2] -MF8 = 'Tangent-at-Two':'linear', [12 -16] -MF9 = 'Tangent-at-Three':'linear', [27 -54] -MF10 = 'Tangent-at-Four':'linear', [48 -128] -MF11 = 'Tangent-at-Five':'linear', [75 -250] - -[Rules] -1, 1 (1) : 1 -2, 2 (1) : 1 -3, 3 (1) : 1 -4, 4 (1) : 1 -5, 5 (1) : 1 -6, 6 (1) : 1 -7, 7 (1) : 1 -8, 8 (1) : 1 -9, 9 (1) : 1 -10, 10 (1) : 1 -11, 11 (1) : 1 Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/cubic_approx_demo.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/cubic_approx_demo.m 2011-09-01 11:37:55 UTC (rev 8483) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/cubic_approx_demo.m 2011-09-01 15:12:29 UTC (rev 8484) @@ -40,10 +40,10 @@ ## Keywords: fuzzy-logic-toolkit fuzzy tests demos ## Directory: fuzzy-logic-toolkit/inst ## Filename: cubic_approx_demo.m -## Last-Modified: 17 Jul 2011 +## Last-Modified: 27 Aug 2011 ## Read the FIS structure from a file. -fis = readfis ('cubic-approximator.fis'); +fis = readfis ('cubic_approximator.fis'); ## Plot the input membership functions. plotmf (fis, 'input', 1); Added: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/cubic_approximator.fis =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/cubic_approximator.fis (rev 0) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/cubic_approximator.fis 2011-09-01 15:12:29 UTC (rev 8484) @@ -0,0 +1,57 @@ +[System] +Name='Cubic-Approximator' +Type='sugeno' +Version=2.0 +NumInputs=1 +NumOutputs=1 +NumRules=11 +AndMethod='min' +OrMethod='max' +ImpMethod='min' +AggMethod='max' +DefuzzMethod='wtaver' + +[Input1] +Name='X' +Range=[-5 5] +NumMFs=11 +MF1 = 'About-Neg-Five':'trimf', [-6 -5 -4] +MF2 = 'About-Neg-Four':'trimf', [-5 -4 -3] +MF3 = 'About-Neg-Three':'trimf', [-4 -3 -2] +MF4 = 'About-Neg-Two':'trimf', [-3 -2 -1] +MF5 = 'About-Neg-One':'trimf', [-2 -1 0] +MF6 = 'About-Zero':'trimf', [-1 0 1] +MF7 = 'About-One':'trimf', [0 1 2] +MF8 = 'About-Two':'trimf', [1 2 3] +MF9 = 'About-Three':'trimf', [2 3 4] +MF10 = 'About-Four':'trimf', [3 4 5] +MF11 = 'About-Five':'trimf', [4 5 6] + +[Output1] +Name='Approx-X-Cubed' +Range=[-130 130] +NumMFs=11 +MF1 = 'Tangent-at-Neg-Five':'linear', [75 250] +MF2 = 'Tangent-at-Neg-Four':'linear', [48 128] +MF3 = 'Tangent-at-Neg-Three':'linear', [27 54] +MF4 = 'Tangent-at-Neg-Two':'linear', [12 16] +MF5 = 'Tangent-at-Neg-One':'linear', [3 2] +MF6 = 'Tangent-at-Zero':'linear', [0 0] +MF7 = 'Tangent-at-One':'linear', [3 -2] +MF8 = 'Tangent-at-Two':'linear', [12 -16] +MF9 = 'Tangent-at-Three':'linear', [27 -54] +MF10 = 'Tangent-at-Four':'linear', [48 -128] +MF11 = 'Tangent-at-Five':'linear', [75 -250] + +[Rules] +1, 1 (1) : 1 +2, 2 (1) : 1 +3, 3 (1) : 1 +4, 4 (1) : 1 +5, 5 (1) : 1 +6, 6 (1) : 1 +7, 7 (1) : 1 +8, 8 (1) : 1 +9, 9 (1) : 1 +10, 10 (1) : 1 +11, 11 (1) : 1 Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/gensurf.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/gensurf.m 2011-09-01 11:37:55 UTC (rev 8483) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/gensurf.m 2011-09-01 15:12:29 UTC (rev 8484) @@ -68,16 +68,9 @@ ## sugeno_tip_demo.m ## @end itemize ## -## CURRENT LIMITATIONS: -## @itemize @bullet -## @item -## The FIS for which the surface is generated must have only one output. -## @item -## grids must have length 2. -## @item +## CURRENT LIMITATION: ## The form of gensurf that suppresses plotting (the final form above) is not yet ## implemented. -## @end itemize ## ## @seealso{cubic_approx_demo, heart_demo_1, heart_demo_2, linear_tip_demo, mamdani_tip_demo, sugeno_tip_demo, plotmf} ## @end deftypefn @@ -86,15 +79,11 @@ ## Keywords: fuzzy-logic-toolkit fuzzy fuzzy-inference-system fis plot ## Directory: fuzzy-logic-toolkit/inst/ ## Filename: gensurf.m -## Last-Modified: 18 Jul 2011 +## Last-Modified: 30 Aug 2011 function [x, y, z] = gensurf (fis, input_axes=[1 2], output_axis=1, ... grids=[15 15], ref_input=[], num_points=101) - ## TO DO: HANDLE FIS STRUCTURES THAT HAVE MORE THAN 1 OUTPUT - ## TO DO: HANDLE SCALAR GRIDS ARGUMENT - ## TO DO: RENAME X, Y, AND Z. MAKE SURE THEY ARE ASSIGNED VALUES. - ## If gensurf was called with an incorrect number of arguments, or the ## arguments do not have the correct type, print an error message and halt. @@ -184,6 +173,9 @@ ## Create input to FIS using grid points and reference values. num_inputs = columns (fis.input); + if (length (grids) == 1) + grids = [grids grids]; + endif num_grid_pts = prod (grids); fis_input = zeros (num_grid_pts, num_inputs); Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/getfis.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/getfis.m 2011-09-01 11:37:55 UTC (rev 8483) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/getfis.m 2011-09-01 15:12:29 UTC (rev 8484) @@ -35,7 +35,7 @@ ## Return the empty set. ## @item 2 ## Return a specified property of the FIS structure. The properties -## that may be specified are: name, type, numinputs, numoutputs, +## that may be specified are: name, type, version, numinputs, numoutputs, ## numinputmfs, numoutputmfs, numrules, andmethod, ormethod, ## impmethod, addmethod, defuzzmethod, inlabels, outlabels, ## inrange, outrange, inmfs, outmfs, inmflabels, outmflabels, @@ -60,7 +60,7 @@ ## @item fis ## an FIS structure ## @item property -## a string; one of: 'name', 'type', 'numinputs', +## a string; one of: 'name', 'type', 'version', 'numinputs', ## 'numoutputs', 'numinputmfs', 'numoutputmfs', ## 'numrules', 'andmethod', 'ormethod', 'impmethod', ## 'addmethod', 'defuzzmethod' 'inlabels', 'outlabels', @@ -93,7 +93,7 @@ ## Keywords: fuzzy-logic-toolkit fuzzy fuzzy-inference-system fis ## Directory: fuzzy-logic-toolkit/inst/ ## Filename: getfis.m -## Last-Modified: 16 Jul 2011 +## Last-Modified: 31 Aug 2011 ##------------------------------------------------------------------------------ @@ -169,8 +169,8 @@ puts ("Type 'help getfis' for more information.\n"); error ("the first argument to getfis must be an FIS structure\n"); elseif (!(is_string (arg2) && ismember (tolower (arg2), {'name', 'type', ... - 'numinputs', 'numoutputs', 'numinputmfs', 'numoutputmfs', ... - 'numrules', 'andmethod', 'ormethod', 'impmethod', ... + 'version', 'numinputs', 'numoutputs', 'numinputmfs', ... + 'numoutputmfs', 'numrules', 'andmethod', 'ormethod', 'impmethod', ... 'aggmethod', 'defuzzmethod', 'inlabels', 'outlabels', ... 'inrange', 'outrange', 'inmfs', 'outmfs', 'inmflabels', ... 'outmflabels', 'inmftypes', 'outmftypes', 'inmfparams', ... @@ -184,6 +184,7 @@ switch (tolower (arg2)) case 'name' retval = fis.name; case 'type' retval = fis.type; + case 'version' retval = fis.version; case 'numinputs' retval = columns (fis.input); case 'numoutputs' retval = columns (fis.output); case 'numrules' retval = columns(fis.rule); Deleted: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart-disease-risk.fis =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart-disease-risk.fis 2011-09-01 11:37:55 UTC (rev 8483) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart-disease-risk.fis 2011-09-01 15:12:29 UTC (rev 8484) @@ -1,57 +0,0 @@ -[System] -Name='Heart-Disease-Risk' -Type='sugeno' -Version=2.0 -NumInputs=2 -NumOutputs=1 -NumRules=15 -AndMethod='min' -OrMethod='max' -ImpMethod='min' -AggMethod='max' -DefuzzMethod='wtaver' - -[Input1] -Name='LDL-Level' -Range=[0 300] -NumMFs=5 -MF1='Low':'trapmf',[-1 0 90 110] -MF2='Low-Borderline':'trapmf',[90 110 120 140] -MF3='Borderline':'trapmf',[120 140 150 170] -MF4='High-Borderline':'trapmf',[150 170 180 200] -MF5='High':'trapmf',[180 200 300 301] - -[Input2] -Name='HDL-Level' -Range=[0 100] -NumMFs=3 -MF1='Low-HDL':'trapmf',[-1 0 35 45] -MF2='Moderate-HDL':'trapmf',[35 45 55 65] -MF3='High-HDL':'trapmf',[55 65 100 101] - -[Output1] -Name='Heart-Disease-Risk' -Range=[0 10] -NumMFs=5 -MF1='No-Risk':'constant',[0] -MF2='Low-Risk':'constant',[2.5] -MF3='Medium-Risk':'constant',[5] -MF4='High-Risk':'constant',[7.5] -MF5='Extreme-Risk':'constant',[10] - -[Rules] -1 1, 3 (1) : 1 -1 2, 2 (1) : 1 -1 3, 1 (1) : 1 -2 1, 3 (1) : 1 -2 2, 2 (1) : 1 -2 3, 2 (1) : 1 -3 1, 4 (1) : 1 -3 2, 3 (1) : 1 -3 3, 2 (1) : 1 -4 1, 4 (1) : 1 -4 2, 4 (1) : 1 -4 3, 3 (1) : 1 -5 1, 5 (1) : 1 -5 2, 4 (1) : 1 -5 3, 3 (1) : 1 Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart_demo_1.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart_demo_1.m 2011-09-01 11:37:55 UTC (rev 8483) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart_demo_1.m 2011-09-01 15:12:29 UTC (rev 8484) @@ -34,7 +34,7 @@ ## displays information about the FIS in the Octave window ## @end itemize ## -## @seealso{addmf_demo, addvar_demo, heart_demo_2, showrule_demo} +## @seealso{cubic_approx_demo, heart_demo_2, linear_tip_demo, mamdani_tip_demo, sugeno_tip_demo} ## @end deftypefn ## Author: L. Markowsky @@ -43,7 +43,7 @@ ## Keywords: fuzzy-logic-toolkit fuzzy tests demos ## Directory: fuzzy-logic-toolkit/inst ## Filename: heart_demo_1.m -## Last-Modified: 16 Jul 2011 +## Last-Modified: 30 Aug 2011 ## Create new FIS. a = newfis ('Heart-Disease-Risk', 'sugeno', ... Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart_demo_2.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart_demo_2.m 2011-09-01 11:37:55 UTC (rev 8483) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart_demo_2.m 2011-09-01 15:12:29 UTC (rev 8484) @@ -43,13 +43,13 @@ ## Dr. Bruce Segee (University of Maine Dept. of ECE). ## Directory: fuzzy-logic-toolkit/inst ## Filename: heart_demo_2.m -## Last-Modified: 17 Jul 2011 +## Last-Modified: 28 Aug 2011 ## Read the FIS structure from a file. -## (Alternatively, to select heart-disease-risk.fis using the dialog, +## (Alternatively, to select heart_disease_risk.fis using the dialog, ## replace the following line with ## fis = readfis (); -fis = readfis('heart-disease-risk.fis'); +fis = readfis('heart_disease_risk.fis'); ## Plot the input and output membership functions. plotmf (fis, 'input', 1); Added: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart_disease_risk.fis =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart_disease_risk.fis (rev 0) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart_disease_risk.fis 2011-09-01 15:12:29 UTC (rev 8484) @@ -0,0 +1,66 @@ +# Heart Disease Risk FIS + +[System] + + Name = 'Heart-Disease-Risk' + Type = 'sugeno' + Version = 2.0 + NumInputs = 2 + NumOutputs = 1 + NumRules = 15 + AndMethod = 'min' + OrMethod = 'max' + ImpMethod = 'min' + AggMethod = 'max' + DefuzzMethod = 'wtaver' + +[Input1] + + Name = 'LDL-Level' + Range = [0 300] + NumMFs = 5 + MF1 = 'Low' : 'trapmf', [-1 0 90 110] + MF2 = 'Low-Borderline' : 'trapmf', [90 110 120 140] + MF3 = 'Borderline' : 'trapmf', [120 140 150 170] + MF4 = 'High-Borderline' : 'trapmf', [150 170 180 200] + MF5 = 'High' : 'trapmf', [180 200 300 301] + +[Input2] + + Name = 'HDL-Level' + Range = [0 100] + NumMFs = 3 + + MF1 = 'Low-HDL' : 'trapmf', [-1 0 35 45] + MF2 = 'Moderate-HDL' : 'trapmf', [35 45 55 65] + MF3 = 'High-HDL' : 'trapmf', [55 65 100 101] + +[Output1] + + Name = 'Heart-Disease-Risk' + Range = [0 10] + NumMFs = 5 + + MF1 = 'No-Risk' : 'constant', [0] + MF2 = 'Low-Risk' : 'constant', [2.5] + MF3 = 'Medium-Risk' : 'constant', [5] + MF4 = 'High-Risk' : 'constant', [7.5] + MF5 = 'Extreme-Risk' : 'constant', [10] + +[Rules] + + 1 1, 3 (1) : 1 + 1 2, 2 (1) : 1 + 1 3, 1 (1) : 1 + 2 1, 3 (1) : 1 + 2 2, 2 (1) : 1 + 2 3, 2 (1) : 1 + 3 1, 4 (1) : 1 + 3 2, 3 (1) : 1 + 3 3, 2 (1) : 1 + 4 1, 4 (1) : 1 + 4 2, 4 (1) : 1 + 4 3, 3 (1) : 1 + 5 1, 5 (1) : 1 + 5 2, 4 (1) : 1 + 5 3, 3 (1) : 1 Deleted: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/linear-tip-calculator.fis =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/linear-tip-calculator.fis 2011-09-01 11:37:55 UTC (rev 8483) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/linear-tip-calculator.fis 2011-09-01 15:12:29 UTC (rev 8484) @@ -1,40 +0,0 @@ -[System] -Name='Linear-Tip-Calculator' -Type='sugeno' -Version=2.0 -NumInputs=2 -NumOutputs=1 -NumRules=4 -AndMethod='min' -OrMethod='max' -ImpMethod='min' -AggMethod='max' -DefuzzMethod='wtaver' - -[Input1] -Name='Food-Quality' -Range=[1 10] -NumMFs=2 -MF1='Bad':'trapmf',[0 1 3 7] -MF2='Good':'trapmf',[3 7 10 11] - -[Input2] -Name='Service' -Range=[1 10] -NumMFs=2 -MF1='Bad':'trapmf',[0 1 3 7] -MF2='Good':'trapmf',[3 7 10 11] - -[Output1] -Name='Tip' -Range=[10 20] -NumMFs=3 -MF1='Ten-Percent':'linear',[0 0 10] -MF2='Fifteen-Percent':'linear',[0 0 15] -MF3='Twenty-Percent':'linear',[0 0 20] - -[Rules] -1 1, 1 (1) : 1 -1 2, 2 (1) : 1 -2 1, 2 (1) : 1 -2 2, 3 (1) : 1 Added: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/linear_tip_calculator.fis =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/linear_tip_calculator.fis (rev 0) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/linear_tip_calculator.fis 2011-09-01 15:12:29 UTC (rev 8484) @@ -0,0 +1,40 @@ +[System] +Name='Linear-Tip-Calculator' +Type='sugeno' +Version=2.0 +NumInputs=2 +NumOutputs=1 +NumRules=4 +AndMethod='min' +OrMethod='max' +ImpMethod='min' +AggMethod='max' +DefuzzMethod='wtaver' + +[Input1] +Name='Food-Quality' +Range=[1 10] +NumMFs=2 +MF1='Bad':'trapmf',[0 1 3 7] +MF2='Good':'trapmf',[3 7 10 11] + +[Input2] +Name='Service' +Range=[1 10] +NumMFs=2 +MF1='Bad':'trapmf',[0 1 3 7] +MF2='Good':'trapmf',[3 7 10 11] + +[Output1] +Name='Tip' +Range=[10 20] +NumMFs=3 +MF1='Ten-Percent':'linear',[0 0 10] +MF2='Fifteen-Percent':'linear',[0 0 15] +MF3='Twenty-Percent':'linear',[0 0 20] + +[Rules] +1 1, 1 (1) : 1 +1 2, 2 (1) : 1 +2 1, 2 (1) : 1 +2 2, 3 (1) : 1 Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/linear_tip_demo.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/linear_tip_demo.m 2011-09-01 11:37:55 UTC (rev 8483) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/linear_tip_demo.m 2011-09-01 15:12:29 UTC (rev 8484) @@ -43,10 +43,10 @@ ## Dr. Bruce Segee (University of Maine Dept. of ECE). ## Directory: fuzzy-logic-toolkit/inst ## Filename: linear_tip_demo.m -## Last-Modified: 17 Jul 2011 +## Last-Modified: 27 Aug 2011 ## Read the FIS structure from a file. -fis = readfis ('linear-tip-calculator.fis'); +fis = readfis ('linear_tip_calculator.fis'); ## Plot the input membership functions. plotmf (fis, 'input', 1); Deleted: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/mamdani-tip-calculator.fis =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/mamdani-tip-calculator.fis 2011-09-01 11:37:55 UTC (rev 8483) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/mamdani-tip-calculator.fis 2011-09-01 15:12:29 UTC (rev 8484) @@ -1,40 +0,0 @@ -[System] -Name='Mamdani-Tip-Calculator' -Type='mamdani' -Version=2.0 -NumInputs=2 -NumOutputs=1 -NumRules=4 -AndMethod='min' -OrMethod='max' -ImpMethod='min' -AggMethod='max' -DefuzzMethod='centroid' - -[Input1] -Name='Food-Quality' -Range=[1 10] -NumMFs=2 -MF1='Bad':'trapmf',[0 1 3 7] -MF2='Good':'trapmf',[3 7 10 11] - -[Input2] -Name='Service' -Range=[1 10] -NumMFs=2 -MF1='Bad':'trapmf',[0 1 3 7] -MF2='Good':'trapmf',[3 7 10 11] - -[Output1] -Name='Tip' -Range=[0 30] -NumMFs=3 -MF1='About-Ten-Percent':'gaussmf',[2 10] -MF2='About-Fifteen-Percent':'gaussmf',[2 15] -MF3='About-Twenty-Percent':'gaussmf',[2 20] - -[Rules] -1 1, 1 (1) : 1 -1 2, 2 (1) : 1 -2 1, 2 (1) : 1 -2 2, 3 (1) : 1 Added: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/mamdani_tip_calculator.fis =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/mamdani_tip_calculator.fis (rev 0) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/mamdani_tip_calculator.fis 2011-09-01 15:12:29 UTC (rev 8484) @@ -0,0 +1,48 @@ +[System] +Name='Mamdani-Tip-Calculator' +Type='mamdani' +Version=2.0 +NumInputs=2 +NumOutputs=2 +NumRules=4 +AndMethod='min' +OrMethod='max' +ImpMethod='min' +AggMethod='max' +DefuzzMethod='centroid' + +[Input1] +Name='Food-Quality' +Range=[1 10] +NumMFs=2 +MF1='Bad':'trapmf',[0 1 3 7] +MF2='Good':'trapmf',[3 7 10 11] + +[Input2] +Name='Service' +Range=[1 10] +NumMFs=2 +MF1='Bad':'trapmf',[0 1 3 7] +MF2='Good':'trapmf',[3 7 10 11] + +[Output1] +Name='Tip' +Range=[0 30] +NumMFs=3 +MF1='About-Ten-Percent':'gaussmf',[2 10] +MF2='About-Fifteen-Percent':'gaussmf',[2 15] +MF3='About-Twenty-Percent':'gaussmf',[2 20] + +[Output2] +Name='Check-Plus-Tip' +Range=[1 1.3] +NumMFs=3 +MF1='Plus-About-Ten-Percent':'gaussmf',[0.02 1.10] +MF2='Plus-About-Fifteen-Percent':'gaussmf',[0.02 1.15] +MF3='Plus-About-Twenty-Percent':'gaussmf',[0.02 1.20] + +[Rules] +1 1, 1 1 (1) : 1 +1 2, 2 2 (1) : 1 +2 1, 2 2 (1) : 1 +2 2, 3 3 (1) : 1 Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/mamdani_tip_demo.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/mamdani_tip_demo.m 2011-09-01 11:37:55 UTC (rev 8483) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/mamdani_tip_demo.m 2011-09-01 15:12:29 UTC (rev 8484) @@ -44,23 +44,26 @@ ## Dr. Bruce Segee (University of Maine Dept. of ECE). ## Directory: fuzzy-logic-toolkit/inst ## Filename: mamdani_tip_demo.m -## Last-Modified: 17 Jul 2011 +## Last-Modified: 30 Aug 2011 ## Read the FIS structure from a file. -fis=readfis ('mamdani-tip-calculator'); +fis=readfis ('mamdani_tip_calculator'); ## Plot the input and output membership functions. plotmf (fis, 'input', 1); plotmf (fis, 'input', 2); plotmf (fis, 'output', 1); +plotmf (fis, 'output', 2); -## Plot the Tip as a function of Food-Quality and Service. -gensurf (fis); +## Plot the Tip and Check + Tip as functions of Food-Quality and Service. +gensurf (fis, [1 2], 1); +gensurf (fis, [1 2], 2); -## Calculate the Tip using (Food-Quality, Service) = (4, 6). +## Calculate the Tip and Check + Tip using (Food-Quality, Service) = (4, 6). [output, rule_input, rule_output, fuzzy_output] = evalfis ([4 6], fis, 1001); -## Plot the output of the individual fuzzy rules (on one set of axes). +## Plot the first output (Tip) of the individual fuzzy rules +## on one set of axes. x_axis = linspace (fis.output(1).range(1), fis.output(1).range(2), 1001); colors = ['r' 'b' 'm' 'g']; figure ('NumberTitle', 'off', 'Name', ... @@ -77,12 +80,13 @@ grid; hold; -## Plot the aggregated fuzzy output and the crisp output (on one set of axes). +## Plot the first aggregated fuzzy output and the first crisp output (Tip) +## on one set of axes. figure('NumberTitle', 'off', 'Name', 'Aggregation and Defuzzification for Input = (4, 6)'); -plot (x_axis, fuzzy_output, "b;Aggregated Fuzzy Output;", 'LineWidth', 2); +plot (x_axis, fuzzy_output(:, 1), "b;Aggregated Fuzzy Output;", 'LineWidth', 2); hold on; -crisp_output = evalmf(x_axis, output, 'constant'); -y_label = ["r;Crisp Output = " num2str(output) "%;"]; +crisp_output = evalmf(x_axis, output(1), 'constant'); +y_label = ["r;Crisp Output = " num2str(output(1)) "%;"]; plot (x_axis, crisp_output, y_label, 'LineWidth', 2); ylim ([-0.1, 1.1]); xlabel ('Tip', 'FontWeight', 'bold'); Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/newfis.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/newfis.m 2011-09-01 11:37:55 UTC (rev 8483) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/newfis.m 2011-09-01 15:12:29 UTC (rev 8484) @@ -24,9 +24,10 @@ ## @deftypefnx {Function File} {@var{a} =} newfis (@var{fis_name}, @var{fis_type}, @var{and_method}, @var{or_method}, @var{imp_method}) ## @deftypefnx {Function File} {@var{a} =} newfis (@var{fis_name}, @var{fis_type}, @var{and_method}, @var{or_method}, @var{imp_method}, @var{agg_method}) ## @deftypefnx {Function File} {@var{a} =} newfis (@var{fis_name}, @var{fis_type}, @var{and_method}, @var{or_method}, @var{imp_method}, @var{agg_method}, @var{defuzz_method}) +## @deftypefnx {Function File} {@var{a} =} newfis (@var{fis_name}, @var{fis_type}, @var{and_method}, @var{or_method}, @var{imp_method}, @var{agg_method}, @var{defuzz_method}, @var{fis_version}) ## ## Create and return a new FIS structure using the argument values provided. -## Only the first argument is required. If fewer than seven arguments are given, +## Only the first argument is required. If fewer than eight arguments are given, ## then some or all of the following default arguments will be used: ## @itemize @bullet ## @item @@ -41,6 +42,8 @@ ## @var{agg_method} = 'max' ## @item ## @var{defuzz_method} = 'centroid' +## @item +## @var{fis_version} = 1.0 ## @end itemize ## ## @seealso{addmf, addrule, addvar, setfis} @@ -50,31 +53,32 @@ ## Keywords: fuzzy-logic-toolkit fuzzy fuzzy-inference-system fis ## Directory: fuzzy-logic-toolkit/inst/ ## Filename: newfis.m -## Last-Modified: 19 May 2011 +## Last-Modified: 26 Aug 2011 function fis = newfis (fis_name, fis_type='mamdani', and_method='min', ... or_method='max', imp_method='min', agg_method='max', ... - defuzz_method='centroid') + defuzz_method='centroid', fis_version=1.0) - ## If the caller did not supply the between 1 and 7 argument values, or if + ## If the caller did not supply the between 1 and 8 argument values, or if ## any of the argument values were not strings, print an error message and ## halt. - if (!(nargin >= 1 && nargin <= 7)) + if (!(nargin >= 1 && nargin <= 8)) puts ("Type 'help newfis' for more information.\n"); - error ("newfis requires between 1 and 7 arguments\n"); + error ("newfis requires between 1 and 8 arguments\n"); elseif (!(is_string (fis_name) && is_string (fis_type) && ... is_string (and_method) && is_string (or_method) && ... is_string (imp_method) && is_string (agg_method) && ... - is_string (defuzz_method))) + is_string (defuzz_method) && isfloat (fis_version))) puts ("Type 'help newfis' for more information.\n"); - error ("all arguments to newfis must be strings\n"); + error ("incorrect argument type in newfis argument list\n"); endif ## Create and return the new FIS structure. fis = struct ('name', fis_name, ... 'type', fis_type, ... + 'version', fis_version, ... 'andMethod', and_method, ... 'orMethod', or_method, ... 'impMethod', imp_method, ... Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/defuzzify_output_mamdani.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/defuzzify_output_mamdani.m 2011-09-01 11:37:55 UTC (rev 8483) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/defuzzify_output_mamdani.m 2011-09-01 15:12:29 UTC (rev 8484) @@ -67,13 +67,13 @@ ## Keywords: fuzzy-logic-toolkit fuzzy fuzzy-inference-system fis ## Directory: fuzzy-logic-toolkit/inst/private/ ## Filename: defuzzify_output_mamdani.m -## Last-Modified: 16 Jul 2011 +## Last-Modified: 30 Aug 2011 function output = defuzzify_output_mamdani (fis, fuzzy_output) num_outputs = columns (fis.output); ## num_outputs == L (above) num_points = rows (fuzzy_output); - output = zeros (num_outputs); + output = zeros (1, num_outputs); for i = 1 : num_outputs range = fis.output(i).range; Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/defuzzify_output_sugeno.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/defuzzify_output_sugeno.m 2011-09-01 11:37:55 UTC (rev 8483) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/defuzzify_output_sugeno.m 2011-09-01 15:12:29 UTC (rev 8484) @@ -67,12 +67,12 @@ ## Keywords: fuzzy-logic-toolkit fuzzy fuzzy-inference-system fis ## Directory: fuzzy-logic-toolkit/inst/private/ ## Filename: defuzzify_output_sugeno.m -## Last-Modified: 16 Jul 2011 +## Last-Modified: 29 Aug 2011 function output = defuzzify_output_sugeno (fis, aggregated_output) num_outputs = columns (fis.output); - output = zeros (num_outputs); + output = zeros (1, num_outputs); for i = 1 : num_outputs next_agg_output = aggregated_output(i).aggregated_output; Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/eval_firing_strength.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/eval_firing_strength.m 2011-09-01 11:37:55 UTC (rev 8483) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/eval_firing_strength.m 2011-09-01 15:12:29 UTC (rev 8484) @@ -60,7 +60,7 @@ ## Keywords: fuzzy-logic-toolkit fuzzy fuzzy-inference-system fis ## Directory: fuzzy-logic-toolkit/inst/private/ ## Filename: eval_firing_strength.m -## Last-Modified: 18 Jul 2011 +## Last-Modified: 30 Aug 2011 function firing_strength = eval_firing_strength (fis, rule_input) @@ -68,7 +68,7 @@ num_inputs = columns (fis.input); ## num_inputs == N ## Initialize output matrix to prevent inefficient resizing. - firing_strength = zeros (num_rules); + firing_strength = zeros (1, num_rules); ## For each rule ## 1. Apply connection to find matching degree of the rule antecedent. Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/eval_rules_mamdani.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/eval_rules_mamdani.m 2011-09-01 11:37:55 UTC (rev 8483) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/eval_rules_mamdani.m 2011-09-01 15:12:29 UTC (rev 8484) @@ -67,7 +67,7 @@ ## Keywords: fuzzy-logic-toolkit fuzzy fuzzy-inference-system fis ## Directory: fuzzy-logic-toolkit/inst/private/ ## Filename: eval_rules_mamdani.m -## Last-Modified: 18 Jul 2011 +## Last-Modified: 30 Aug 2011 function rule_output = eval_rules_mamdani (fis, firing_strength, num_points) @@ -110,7 +110,7 @@ ## Store result in column of rule_output corresponding ## to the (rule, output) pair. - rule_output(:, (i - 1) * num_outputs + j) = fuzzy_out'; + rule_output(:, (j - 1) * num_rules + i) = fuzzy_out'; endif endfor endif Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/eval_rules_sugeno.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/eval_rules_sugeno.m 2011-09-01 11:37:55 UTC (rev 8483) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/eval_rules_sugeno.m 2011-09-01 15:12:29 UTC (rev 8484) @@ -61,7 +61,7 @@ ## Keywords: fuzzy-logic-toolkit fuzzy fuzzy-inference-system fis ## Directory: fuzzy-logic-toolkit/inst/private/ ## Filename: eval_rules_sugeno.m -## Last-Modified: 18 Jul 2011 +## Last-Modified: 29 Aug 2011 function rule_output = eval_rules_sugeno (fis, firing_strength, user_input) @@ -105,8 +105,8 @@ ## Store result in column of rule_output corresponding ## to the (rule, output) pair. - rule_output(1, (i - 1) * num_outputs + j) = location; - rule_output(2, (i - 1) * num_outputs + j) = height; + rule_output(1, (j - 1) * num_rules + i) = location; + rule_output(2, (j - 1) * num_rules + i) = height; endif endfor endif Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_grid_spec.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_grid_spec.m 2011-09-01 11:37:55 UTC (rev 8483) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_grid_spec.m 2011-09-01 15:12:29 UTC (rev 8484) @@ -28,11 +28,11 @@ ## Keywords: fuzzy-logic-toolkit fuzzy private parameter-test ## Directory: fuzzy-logic-toolkit/inst/private/ ## Filename: is_grid_spec.m -## Last-Modified: 20 May 2011 +## Last-Modified: 28 Aug 2011 function y = is_grid_spec (x, fis) - if (!(isreal (x) && isvector (x) && (length (x) <= 2))) + if (!(isvector (x) && (length (x) <= 2))) y = 0; else y = 1; Added: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_real.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_real.m (rev 0) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_real.m 2011-09-01 15:12:29 UTC (rev 8484) @@ -0,0 +1,51 @@ +## Copyright (C) 2011 L. Markowsky <lm...@us...> +## +## This file is part of the fuzzy-logic-toolkit. +## +## The fuzzy-logic-toolkit is free software; you can redistribute it +## and/or modify it under the terms of the GNU General Public License +## as published by the Free Software Foundation; either version 3 of +## the License, or (at your option) any later version. +## +## The fuzzy-logic-toolkit is distributed in the hope that it will be +## useful, but WITHOUT ANY WARRANTY; without even the implied warranty +## of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with the fuzzy-logic-toolkit; see the file COPYING. If not, +## see <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} {@var{y} =} is_real (@var{x}) +## +## Return 1 if @var{x} is an real scalar, and return 0 otherwise. +## +## is_real is a private function that localizes the test for real scalars. +## +## Examples: +## @example +## @group +## is_real(6) ==> 1 +## is_real(6.2) ==> 1 +## is_real(ones(2)) ==> 0 +## is_real(6 + 0i) ==> 1 +## is_real(6 + i) ==> 0 +## is_real([0]) ==> 1 +## is_real([0 0]) ==> 0 +## @end group +## @end example +## +## @end deftypefn + +## Author: L. Markowsky +## Keywords: fuzzy-logic-toolkit fuzzy private parameter-test +## Directory: fuzzy-logic-toolkit/inst/private/ +## Filename: is_real.m +## Last-Modified: 26 Aug 2011 + +function y = is_real (x) + + y = isscalar (x) && isreal (x); + +endfunction Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/readfis.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/readfis.m 2011-09-01 11:37:55 UTC (rev 8483) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/readfis.m 2011-09-01 15:12:29 UTC (rev 8484) @@ -26,25 +26,14 @@ ## with a @var{filename} that does not end with '.fis', append '.fis' to the ## @var{filename}. The @var{filename} is expected to be a string. ## -## CURRENT LIMITATIONS: -## @itemize @bullet -## @item -## Custom membership functions are limited to 1-10 parameters. -## @item -## "Version" is not yet implemented. -## @item -## The input file must strictly adhere to the format, without -## comments or extra whitespace. -## @end itemize -## ## Three examples of the input file format: ## @itemize @bullet ## @item -## heart-disease-risk.fis +## heart_disease_risk.fis ## @item -## mamdani-tip-calculator.fis +## mamdani_tip_calculator.fis ## @item -## sugeno-tip-calculator.fis +## sugeno_tip_calculator.fis ## @end itemize ## ## Six examples that use readfis: @@ -70,16 +59,12 @@ ## Keywords: fuzzy-logic-toolkit fuzzy fuzzy-inference-system fis ## Directory: fuzzy-logic-toolkit/inst/ ## Filename: readfis.m -## Last-Modified: 16 Jul 2011 +## Last-Modified: 28 Aug 2011 -##------------------------------------------------------------------------------ - function fis = readfis (filename='') - ##-------------------------------------------------------------------------- ## If readfis was not called with 0 or 1 arguments, or if the argument is ## not a string, print an error message and halt. - ##-------------------------------------------------------------------------- if (nargin > 1) puts ("Type 'help readfis' for more information.\n"); @@ -89,95 +74,23 @@ error ("readfis's argument must be a string\n"); endif - ##-------------------------------------------------------------------------- ## Open the input file. - ##-------------------------------------------------------------------------- fid = open_input_file (filename); - ##-------------------------------------------------------------------------- - ## Read the [System] section. - ## Using the strings read from the input file, initialize an FIS structure. - ##-------------------------------------------------------------------------- + ## Read the [System], [Input<number>], [Output<number>], and [Rules] + ## sections of the input file. - line_num = 1; [fis, num_inputs, num_outputs, num_rules, line_num] = ... - init_fis_struct (fid, line_num); + init_fis_struct (fid); + [fis, line_num] = read_fis_inputs (fid, fis, num_inputs, line_num); + [fis, line_num] = read_fis_outputs (fid, fis, num_outputs, line_num); + fis = read_rules (fid, fis, num_inputs, num_outputs, num_rules, line_num); - ##-------------------------------------------------------------------------- - ## For each FIS input, read [Input<number>] section from file. - ## Add each new input to the FIS structure. - ##-------------------------------------------------------------------------- + ## Close the input file. - for i = 1 : num_inputs - [next_fis_input, num_mfs, line_num] = ... - get_next_fis_io (fid, line_num, i, 'input'); - if (i == 1) - fis.input = next_fis_input; - else - fis.input = [fis.input, next_fis_input]; - endif + fclose (fid); - ##---------------------------------------------------------------------- - ## Read membership function info for the new FIS input from file. - ## Add each new membership function to the FIS struct. - ##---------------------------------------------------------------------- - - for j = 1 : num_mfs - [next_mf, line_num] = get_next_mf (fid, line_num, i, j, 'input'); - if (j == 1) - fis.input(i).mf = next_mf; - else - fis.input(i).mf = [fis.input(i).mf, next_mf]; - endif - endfor - endfor - - ##-------------------------------------------------------------------------- - ## For each FIS output, read [Output<number>] section from file. - ## Add each new output to the FIS structure. - ##-------------------------------------------------------------------------- - - for i = 1 : num_outputs - [next_fis_output, num_mfs, line_num] = ... - get_next_fis_io (fid, line_num, i, 'output'); - if (i == 1) - fis.output = next_fis_output; - else - fis.output = [fis.output, next_fis_output]; - endif - - ##---------------------------------------------------------------------- - ## Read membership function info for the new FIS output from file. - ... [truncated message content] |