From: <lm...@us...> - 2011-05-25 15:26:29
|
Revision: 8286 http://octave.svn.sourceforge.net/octave/?rev=8286&view=rev Author: lmarkov Date: 2011-05-25 15:26:19 +0000 (Wed, 25 May 2011) Log Message: ----------- A fuzzy-logic-toolkit A fuzzy-logic-toolkit/DESCRIPTION A fuzzy-logic-toolkit/INDEX A fuzzy-logic-toolkit/COPYING A fuzzy-logic-toolkit/inst A fuzzy-logic-toolkit/inst/smf.m A fuzzy-logic-toolkit/inst/trimf_demo.m A fuzzy-logic-toolkit/inst/rmvar.m A fuzzy-logic-toolkit/inst/gauss2mf.m A fuzzy-logic-toolkit/inst/psigmf_demo.m A fuzzy-logic-toolkit/inst/zmf.m A fuzzy-logic-toolkit/inst/writefis.m A fuzzy-logic-toolkit/inst/trapmf_demo.m A fuzzy-logic-toolkit/inst/pimf_demo.m A fuzzy-logic-toolkit/inst/zmf_demo.m A fuzzy-logic-toolkit/inst/addvar.m A fuzzy-logic-toolkit/inst/sugeno-tip-calculator.fis A fuzzy-logic-toolkit/inst/gbellmf.m A fuzzy-logic-toolkit/inst/showrule.m A fuzzy-logic-toolkit/inst/sigmf_demo.m A fuzzy-logic-toolkit/inst/dsigmf.m A fuzzy-logic-toolkit/inst/gaussmf_demo.m A fuzzy-logic-toolkit/inst/gensurf.m A fuzzy-logic-toolkit/inst/mamdani_demo.m A fuzzy-logic-toolkit/inst/gbellmf_demo.m A fuzzy-logic-toolkit/inst/showrule_demo.m A fuzzy-logic-toolkit/inst/addmf_demo.m A fuzzy-logic-toolkit/inst/trimf.m A fuzzy-logic-toolkit/inst/getfis.m A fuzzy-logic-toolkit/inst/showfis.m A fuzzy-logic-toolkit/inst/psigmf.m A fuzzy-logic-toolkit/inst/smf_demo.m A fuzzy-logic-toolkit/inst/trapmf.m A fuzzy-logic-toolkit/inst/evalfis.m A fuzzy-logic-toolkit/inst/commandline_demo.m A fuzzy-logic-toolkit/inst/gauss2mf_demo.m A fuzzy-logic-toolkit/inst/newfis.m A fuzzy-logic-toolkit/inst/pimf.m A fuzzy-logic-toolkit/inst/setfis.m A fuzzy-logic-toolkit/inst/plotmf.m A fuzzy-logic-toolkit/inst/rmmf.m A fuzzy-logic-toolkit/inst/addvar_demo.m A fuzzy-logic-toolkit/inst/gaussmf.m A fuzzy-logic-toolkit/inst/sigmf.m A fuzzy-logic-toolkit/inst/heart_demo.m A fuzzy-logic-toolkit/inst/defuzz.m A fuzzy-logic-toolkit/inst/heart-disease-risk.fis A fuzzy-logic-toolkit/inst/evalmf.m A fuzzy-logic-toolkit/inst/addmf.m A fuzzy-logic-toolkit/inst/mamdani-tip-calculator.fis A fuzzy-logic-toolkit/inst/readfis.m A fuzzy-logic-toolkit/inst/dsigmf_demo.m A fuzzy-logic-toolkit/inst/evalmf_demo.m A fuzzy-logic-toolkit/inst/tipping_demo.m A fuzzy-logic-toolkit/inst/private A fuzzy-logic-toolkit/inst/private/is_io_vector.m A fuzzy-logic-toolkit/inst/private/is_rule_vector.m A fuzzy-logic-toolkit/inst/private/are_input_indices.m A fuzzy-logic-toolkit/inst/private/defuzzify_output_mamdani.m A fuzzy-logic-toolkit/inst/private/aggregate_output_sugeno.m A fuzzy-logic-toolkit/inst/private/is_ref_input.m A fuzzy-logic-toolkit/inst/private/is_grid_spec.m A fuzzy-logic-toolkit/inst/private/is_real_matrix.m A fuzzy-logic-toolkit/inst/private/eval_firing_strength.m A fuzzy-logic-toolkit/inst/private/is_io_struct.m A fuzzy-logic-toolkit/inst/private/is_pos_int.m A fuzzy-logic-toolkit/inst/private/is_rule_struct.m A fuzzy-logic-toolkit/inst/private/is_mf_vector.m A fuzzy-logic-toolkit/inst/private/are_bounds.m A fuzzy-logic-toolkit/inst/private/eval_rules_sugeno.m A fuzzy-logic-toolkit/inst/private/is_output_index.m A fuzzy-logic-toolkit/inst/private/is_format.m A fuzzy-logic-toolkit/inst/private/evalfis_private.m A fuzzy-logic-toolkit/inst/private/is_row_vector.m A fuzzy-logic-toolkit/inst/private/is_rule_index_list.m A fuzzy-logic-toolkit/inst/private/is_mf_index.m A fuzzy-logic-toolkit/inst/private/fuzzify_input.m A fuzzy-logic-toolkit/inst/private/is_int.m A fuzzy-logic-toolkit/inst/private/eval_rules_mamdani.m A fuzzy-logic-toolkit/inst/private/are_mf_params.m A fuzzy-logic-toolkit/inst/private/aggregate_output_mamdani.m A fuzzy-logic-toolkit/inst/private/is_string.m A fuzzy-logic-toolkit/inst/private/is_mf_struct.m A fuzzy-logic-toolkit/inst/private/is_domain.m A fuzzy-logic-toolkit/inst/private/probor.m A fuzzy-logic-toolkit/inst/private/evalmf_private.m A fuzzy-logic-toolkit/inst/private/is_var_index.m A fuzzy-logic-toolkit/inst/private/is_fis.m A fuzzy-logic-toolkit/inst/private/is_input_matrix.m A fuzzy-logic-toolkit/inst/private/is_language.m A fuzzy-logic-toolkit/inst/private/defuzzify_output_sugeno.m A fuzzy-logic-toolkit/inst/addrule.m Added Paths: ----------- trunk/octave-forge/main/fuzzy-logic-toolkit/ trunk/octave-forge/main/fuzzy-logic-toolkit/COPYING trunk/octave-forge/main/fuzzy-logic-toolkit/DESCRIPTION trunk/octave-forge/main/fuzzy-logic-toolkit/INDEX trunk/octave-forge/main/fuzzy-logic-toolkit/inst/ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addmf.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addmf_demo.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addrule.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addvar.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addvar_demo.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/commandline_demo.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/defuzz.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/dsigmf.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/dsigmf_demo.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/evalfis.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/evalmf.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/evalmf_demo.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/gauss2mf.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/gauss2mf_demo.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/gaussmf.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/gaussmf_demo.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/gbellmf.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/gbellmf_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-disease-risk.fis trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart_demo.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/mamdani-tip-calculator.fis trunk/octave-forge/main/fuzzy-logic-toolkit/inst/mamdani_demo.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/newfis.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/pimf.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/pimf_demo.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/plotmf.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/aggregate_output_mamdani.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/aggregate_output_sugeno.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/are_bounds.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/are_input_indices.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/are_mf_params.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/evalfis_private.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/evalmf_private.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/fuzzify_input.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_domain.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_fis.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_format.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_grid_spec.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_input_matrix.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_int.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_io_struct.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_io_vector.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_language.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_mf_index.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_mf_struct.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_mf_vector.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_output_index.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_pos_int.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_real_matrix.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_ref_input.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_row_vector.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_rule_index_list.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_rule_struct.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_rule_vector.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_string.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/is_var_index.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/private/probor.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/psigmf.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/psigmf_demo.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/readfis.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/rmmf.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/rmvar.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/setfis.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/showfis.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/showrule.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/showrule_demo.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/sigmf.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/sigmf_demo.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/smf.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/smf_demo.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/sugeno-tip-calculator.fis trunk/octave-forge/main/fuzzy-logic-toolkit/inst/tipping_demo.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/trapmf.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/trapmf_demo.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/trimf.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/trimf_demo.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/writefis.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/zmf.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/zmf_demo.m Added: trunk/octave-forge/main/fuzzy-logic-toolkit/COPYING =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/COPYING (rev 0) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/COPYING 2011-05-25 15:26:19 UTC (rev 8286) @@ -0,0 +1,337 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program 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 2 of the License, or + (at your option) any later version. + + This program 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 this program; if not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. Added: trunk/octave-forge/main/fuzzy-logic-toolkit/DESCRIPTION =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/DESCRIPTION (rev 0) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/DESCRIPTION 2011-05-25 15:26:19 UTC (rev 8286) @@ -0,0 +1,11 @@ +Name: fuzzy-logic-toolkit +Version: 0.2 +Date: 2011-5-20 +Author: L. Markowsky <lm...@us...> +Maintainer: L. Markowsky <lm...@us...> +Title: Octave Fuzzy Logic Toolkit +Description: A mostly MATLAB-compatible fuzzy logic toolkit for Octave. +Depends: octave (>= 3.2.4) +Autoload: yes +License: GPL version 2 or later +Url: http://octave.sf.net Added: trunk/octave-forge/main/fuzzy-logic-toolkit/INDEX =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/INDEX (rev 0) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/INDEX 2011-05-25 15:26:19 UTC (rev 8286) @@ -0,0 +1,106 @@ +fuzzy-logic-toolkit >> Octave Fuzzy Logic Toolkit + +Evaluation + defuzz + evalfis + evalmf + +Plotting + gensurf + plotmf + +File Input/Output of Fuzzy Inference Systems + readfis + writefis + +Command-Line Creation and Modification of Fuzzy Inference Systems + addmf + addrule + addvar + newfis + rmmf + rmvar + setfis + +Text Representation of Fuzzy Inference Systems + getfis + showfis + showrule + +Membership Functions + dsigmf + gauss2mf + gaussmf + gbellmf + pimf + psigmf + sigmf + smf + trapmf + trimf + zmf + +Membership Function Demos + dsigmf_demo + evalmf_demo + gauss2mf_demo + gaussmf_demo + gbellmf_demo + pimf_demo + psigmf_demo + sigmf_demo + smf_demo + trapmf_demo + trimf_demo + zmf_demo + +Fuzzy Inference System Demos + addvar_demo + commandline_demo + heart_demo + mamdani_demo + showrule_demo + tipping_demo + +Fuzzification, Evaluation, and Defuzzification (Private) + aggregate_output_mamdani + aggregate_output_sugeno + defuzzify_output_mamdani + defuzzify_output_sugeno + eval_firing_strength + evalfis_private + evalmf_private + eval_rules_mamdani + eval_rules_sugeno + fuzzify_input + +Parameter Tests (Private) + are_bounds + are_input_indices + are_mf_params + is_domain + is_fis + is_format + is_grid_spec + is_input_matrix + is_int + is_io_struct + is_io_vector + is_language + is_mf_index + is_mf_struct + is_mf_vector + is_output_index + is_pos_int + is_real_matrix + is_ref_input + is_row_vector + is_rule_index_list + is_rule_struct + is_rule_vector + is_string + is_var_index + +Misc Functions (Private) + probor + Added: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addmf.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addmf.m (rev 0) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addmf.m 2011-05-25 15:26:19 UTC (rev 8286) @@ -0,0 +1,137 @@ +## 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{fis} =} addmf (@var{fis}, @var{in_or_out}, @var{var_index}, @var{mf_name}, @var{mf_type}, @var{mf_params}) +## +## Add a membership function to an existing FIS (Fuzzy Inference System) +## structure and return the updated FIS. +## +## The types of the arguments are expected to be: +## @itemize @w +## @item @var{fis}: +## an FIS structure +## @item @var{in_or_out}: +## 'input' or 'output' (case-insensitive) +## @item @var{var_index}: +## valid index of an FIS input/output variable +## @item @var{mf_name}: +## a string +## @item @var{mf_type}: +## a string +## @item @var{mf_params}: +## a vector +## @end itemize +## +## If @var{mf_type} is one of the built-in membership functions, then the +## number and values of the parameters must satisfy the membership function +## requirements for the specified @var{mf_type}. +## +## Note that addmf will allow the user to add membership functions or +## membership function names for a given input or output variable that +## duplicate mfs or mf names already entered. +## +## Also, constant and linear membership functions are not restricted to FIS +## 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. +## +## @seealso{addmf_demo, rmmf, setfis} +## @end deftypefn + +## Author: L. Markowsky +## Keywords: fuzzy-logic-toolkit fuzzy membership-function membership +## Directory: fuzzy-logic-toolkit/inst/ +## Filename: addmf.m +## Version: 0.2 +## Last-Modified: 19 May 2011 + +function fis = addmf (fis, in_or_out, var_index, mf_name, mf_type, mf_params) + + ## If the caller did not supply 6 argument values with the correct types, + ## print an error message and halt. + + if (nargin != 6) + puts ("Type 'help addmf' for more information.\n"); + error ("addmf requires 6 arguments\n"); + elseif (!is_fis (fis)) + puts ("Type 'help addmf' for more information.\n"); + error ("addmf's first argument must be an FIS structure\n"); + elseif (!(is_string (in_or_out) && ... + ismember (tolower (in_or_out), {'input', 'output'}))) + puts ("Type 'help addmf' for more information.\n"); + error ("addmf's second argument must be 'input' or 'output'\n"); + elseif (!is_var_index (fis, in_or_out, var_index)) + puts ("Type 'help addmf' for more information.\n"); + error ("addmf's third argument must be a variable index\n"); + elseif (!(is_string (mf_name) && is_string (mf_type))) + puts ("Type 'help addmf' for more information.\n"); + error ("addmf's fourth and fifth arguments must be strings\n"); + elseif (!are_mf_params (mf_type, mf_params)) + puts ("Type 'help addmf' for more information.\n"); + error ("addmf's sixth argument must be a vector of parameters\n"); + endif + + ## Create a new membership function struct and update the FIS structure. + + new_mf = struct ('name', mf_name, 'type', mf_type, 'params', mf_params); + if (strcmp (tolower (in_or_out), 'input')) + fis.input(var_index).mf = [fis.input(var_index).mf, new_mf]; + else + fis.output(var_index).mf = [fis.output(var_index).mf, new_mf]; + endif + +endfunction Added: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addmf_demo.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addmf_demo.m (rev 0) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addmf_demo.m 2011-05-25 15:26:19 UTC (rev 8286) @@ -0,0 +1,56 @@ +## 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} +## @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 +## Version: 0.2 +## Last-Modified: 19 May 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); Added: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addrule.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addrule.m (rev 0) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addrule.m 2011-05-25 15:26:19 UTC (rev 8286) @@ -0,0 +1,110 @@ +## 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{fis} =} addrule (@var{fis}, @var{rule_matrix}) +## +## Add a list of rules to an existing FIS (Fuzzy Inference System) and return +## the updated FIS. +## +## Each row of the @var{rule_matrix} represents one rule and has the form: +## @example +## [in1_mf ... inM_mf out1_mf ... outN_mf weight connect] +## @end example +## +## @noindent +## where: +## +## @itemize @w +## @item +## in<i>_mf == membership function index for input i +## @item +## out<j>_mf == membership function index for output j +## @item +## weight == relative weight of the rule (0 <= weight <= 1) +## @item +## connect == antecedent connective (1 == and; 2 == or) +## @end itemize +## +## To express the hedge "not", prepend a minus sign to the membership function +## index. ("Not" is the only hedge supported.) To omit an input or output, use +## 0 for the membership function index. The consequent connective is always +## "and". +## +## @noindent +## For example, to express: +## @example +## "If input_1 is mf_2 or input_3 is not mf_1, +## then output_2 is mf_1." +## @end example +## +## @noindent +## with weight 1, the corresponding row of @var{rule_matrix} would be: +## @example +## [2 0 -1 0 1 1 2] +## @end example +## +## @noindent +## For a complete example that uses addrule, see commandline_demo.m. +## +## @seealso{commandline_demo, showrule} +## @end deftypefn + +## Author: L. Markowsky +## Keywords: fuzzy-logic-toolkit fuzzy rule +## Directory: fuzzy-logic-toolkit/inst/ +## Filename: addrule.m +## Version: 0.2 +## Last-Modified: 19 May 2011 + +function fis = addrule (fis, rule_matrix) + + ## If the caller did not supply 2 argument values with the correct types, + ## print an error message and halt. + + if (nargin != 2) + puts ("Type 'help addrule' for more information.\n"); + error ("addrule requires 2 arguments\n"); + elseif (!is_fis (fis)) + puts ("Type 'help addrule' for more information.\n"); + error ("addrule's first argument must be an FIS structure\n"); + elseif (!is_real_matrix (rule_matrix)) + puts ("Type 'help addrule' for more information.\n"); + error ("addrule's second argument must be a matrix of real numbers\n"); + endif + + ## For each row in the rule_matrix, create a new rule struct and update + ## the FIS structure. + + num_inputs = columns (fis.input); + num_outputs = columns (fis.output); + + for i = 1 : rows (rule_matrix) + antecedent = rule_matrix(i, 1 : num_inputs); + consequent = rule_matrix(i, (num_inputs+1) : (num_inputs+num_outputs)); + weight = rule_matrix(i, num_inputs + num_outputs + 1); + connection = rule_matrix(i, num_inputs + num_outputs + 2); + new_rules(i) = struct ('antecedent', antecedent, ... + 'consequent', consequent, ... + 'weight', weight, ... + 'connection', connection); + endfor + + fis.rule = [fis.rule, new_rules]; + +endfunction Added: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addvar.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addvar.m (rev 0) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addvar.m 2011-05-25 15:26:19 UTC (rev 8286) @@ -0,0 +1,100 @@ +## 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{fis} =} addvar (@var{fis}, @var{in_or_out}, @var{var_name}, @var{var_range}) +## +## Add an input or output variable to an existing FIS (Fuzzy Inference System) +## structure and return the updated FIS. +## +## The types of the arguments are expected to be: +## @itemize @w +## @item +## @var{fis} - an FIS structure +## @item +## @var{in_or_out} - either 'input' or 'output' (case-insensitive) +## @item +## @var{var_name} - a string +## @item +## @var{var_range} - a vector [x1 x2] of two real numbers +## @end itemize +## +## 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. +## +## @seealso{addvar_demo} +## @end deftypefn + +## Author: L. Markowsky +## Keywords: fuzzy-logic-toolkit fuzzy variable +## Directory: fuzzy-logic-toolkit/inst/ +## Filename: addvar.m +## Version: 0.2 +## Last-Modified: 19 May 2011 + +function fis = addvar (fis, in_or_out, var_name, var_range) + + ## If the caller did not supply 4 argument values with the correct types, + ## print an error message and halt. + + if (nargin != 4) + puts ("Type 'help addvar' for more information.\n"); + error ("addvar requires 4 arguments\n"); + elseif (!is_fis (fis)) + puts ("Type 'help addvar' for more information.\n"); + error ("addvar's first argument must be an FIS structure\n"); + elseif (!(is_string (in_or_out) && ... + ismember (tolower (in_or_out), {'input', 'output'}))) + puts ("Type 'help addvar' for more information.\n"); + error ("addvar's second argument must be 'input' or 'output'\n"); + elseif (!is_string (var_name)) + puts ("Type 'help addvar' for more information.\n"); + error ("addvar's third argument must be a string\n\n"); + elseif (!are_bounds (var_range)) + puts ("Type 'help addvar' for more information.\n"); + error ("addvar's fourth argument must specify variable bounds\n"); + endif + + ## Create a new variable struct and update the FIS input or output + ## variable list. + + new_variable = struct ('name', var_name, 'range', var_range, 'mf', []); + if (strcmp (tolower (in_or_out), 'input')) + fis.input = [fis.input, new_variable]; + else + fis.output = [fis.output, new_variable]; + endif + +endfunction Added: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addvar_demo.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addvar_demo.m (rev 0) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/addvar_demo.m 2011-05-25 15:26:19 UTC (rev 8286) @@ -0,0 +1,38 @@ +## 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} +## @end deftypefn + +## Author: L. Markowsky +## Keywords: fuzzy-logic-toolkit fuzzy tests demos +## Directory: fuzzy-logic-toolkit/inst +## Filename: addvar_demo.m +## Version: 0.2 +## Last-Modified: 19 May 2011 + +a = newfis ('Heart-Disease-Risk', 'sugeno', ... + 'min', 'max', 'min', 'max', 'wtaver'); +a = addvar (a, 'input', 'LDL-Level', [0 300]); +getfis (a, 'input', 1); Added: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/commandline_demo.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/commandline_demo.m (rev 0) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/commandline_demo.m 2011-05-25 15:26:19 UTC (rev 8286) @@ -0,0 +1,103 @@ +## 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} {} commandline_demo +## +## Demonstrate the use of command-line functions to: +## @itemize @minus +## @item +## build an FIS +## @item +## plot the input and output membership functions +## @item +## plot an output as a function of two inputs +## @item +## display information about the FIS in the Octave window +## @end itemize +## +## @seealso{addmf_demo, addvar_demo, heart_demo, mamdani_demo, tipping_demo} +## @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: commandline_demo.m +## Version: 0.2 +## Last-Modified: 19 May 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); + +## Add one output and its membership functions. +a = addvar (a, 'output', 'Heart-Disease-Risk', [0 10]); +a = addmf (a, 'output', 1, 'No-Risk', 'constant', 0); +a = addmf (a, 'output', 1, 'Low-Risk', 'constant', 2.5); +a = addmf (a, 'output', 1, 'Medium-Risk', 'constant', 5); +a = addmf (a, 'output', 1, 'High-Risk', 'constant', 7.5); +a = addmf (a, 'output', 1, 'Extreme-Risk', 'constant', 10); + +## Plot the output membership functions. +plotmf (a, 'output', 1); + +## Add 15 rules and display them in verbose format. +a = addrule (a, [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]); +puts ("\nOutput of showrule(a):\n\n"); +showrule (a); + +## Plot the output as a function of the two inputs. +gensurf (a); + +## Show the FIS in the Octave window. +puts ("\nOutput of showfis(a):\n\n"); +showfis (a); + Added: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/defuzz.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/defuzz.m (rev 0) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/defuzz.m 2011-05-25 15:26:19 UTC (rev 8286) @@ -0,0 +1,250 @@ +## 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{crisp_x} =} defuzz (@var{x}, @var{y}, @var{defuzz_method}) +## @deftypefnx {Function File} {@var{crisp_x} =} defuzz (@var{[x1 x2 ... xn]}, @var{[y1 y2 ... yn]}, @var{defuzz_method}) +## +## Return the defuzzified (crisp) value of @var{x} using the defuzzification +## method specified by the third argument for the given domain (@var{x} or +## @var{[x1 x2 ... xn]}) and y-values (@var{y} or @var{[y1 y2 ... yn]}). +## +## The arguments @var{x} and @var{y} must be either two real numbers or +## two equal-length, non-empty vectors of reals, with the elements of @var{x} +## strictly increasing. @var{defuzz_method} must be a (case-sensitive) string +## corresponding to a defuzzification method. Defuzz handles both built-in +## and custom defuzzification methods. +## +## The built-in defuzzification methods are: +## @table @samp +## @item centroid +## Return the x-value of the centroid. +## @item bisector +## Return the x-value of the vertical bisector of the area. +## @item mom +## Return the mean x-value of the points with maximum y-values. +## @item som +## Return the smallest (absolute) x-value of the points with maximum y-values. +## @item lom +## Return the largest (absolute) x-value of the points with maximum y-values. +## @item wtaver +## Return the weighted average of the x-values, with the y-values used as +## weights. +## @item wtsum +## Return the weighted sum of the x-values, with the y-values used as weights. +## @end table +## @end deftypefn + +## Author: L. Markowsky +## Keywords: fuzzy-logic-toolkit fuzzy defuzzification +## Directory: fuzzy-logic-toolkit/inst/ +## Filename: defuzz.m +## Version: 0.2 +## Last-Modified: 19 May 2011 + +##------------------------------------------------------------------------------ + +function crisp_x = defuzz (x, y, defuzz_method) + + ## If the caller did not supply 3 argument values with the correct types, + ## print an error message and halt. + + if (nargin != 3) + puts ("Type 'help defuzz' for more information.\n"); + error ("defuzz requires 3 arguments\n"); + elseif (!is_domain (x)) + puts ("Type 'help defuzz' for more information.\n"); + error ("defuzz's first argument must be a valid domain\n"); + elseif (!(isvector (y) && isreal (y) && length (x) == length (y))) + puts ("Type 'help defuzz' for more information.\n"); + error ("defuzz's second argument must be a real number or vector\n"); + elseif (!is_string (defuzz_method)) + puts ("Type 'help defuzz' for more information.\n"); + error ("defuzz's third argument must be a string\n"); + endif + + ## Calculate and return the defuzzified (crisp_x) value using the method + ## specified by the argument defuzz_method. + + crisp_x = str2func (defuzz_method) (x, y); + +endfunction + +##------------------------------------------------------------------------------ +## Usage: crisp_x = centroid (x, y) +## crisp_x = centroid ([x1 x2 ... xn], [y1 y2 ... yn]) +## +## For a given domain (x or [x1 x2 ... xn]) and corresponding y-values +## (y or [y1 y2 ... yn]), return the x-value of the centroid of the region +## described by the points (xi, yi). +## +## Both arguments are assumed to be reals or non-empty vectors of reals. +## In addition, x is assumed to be strictly increasing, and x and y are assumed +## to be of equal length. +##------------------------------------------------------------------------------ + +function crisp_x = centroid (x, y) + + crisp_x = trapz (x, x.*y) / trapz (x, y); + +endfunction + +##------------------------------------------------------------------------------ +## Usage: crisp_x = bisector (x, y) +## crisp_x = bisector ([x1 x2 ... xn], [y1 y2 ... yn]) +## +## For a given domain (x or [x1 x2 ... xn]) and corresponding y-values +## (y or [y1 y2 ... yn]), return the x-value of a bisector of the region +## described by the points (xi, yi). +## +## Both arguments are assumed to be reals or non-empty vectors of reals. +## In addition, x is assumed to be strictly increasing, and x and y are assumed +## to be of equal length. +##------------------------------------------------------------------------------ + +function crisp_x = bisector (x, y) + + ## Find the bisector using a binary search. To ensure that the function + ## terminates, add a counter to limit the iterations to the length of the + ## vectors x and y. + + half_area = trapz (x, y) / 2; + x_len = length (x); + upper = x_len; + lower = 1; + count = 1; + + while ((lower <= upper) && (count++ < x_len)) + midpoint = round ((lower + upper)/2); + left_domain = [ones(1, midpoint), zeros(1, x_len-midpoint)]; + left_y_vals = left_domain .* y; +... [truncated message content] |