bugGNU Octave - Bugs: bug #56008, [octave forge]...

 
 

bug #56008: [octave forge] (fuzzy-logic-toolkit) defuzz provides inaccurate result

Submitter:  Luis <lalucas_1967>
Submitted:  Wed 27 Mar 2019 02:18:05 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Inaccurate Result
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 23 Feb 2021 06:25:34 AM UTC, comment #3: 

Thanks for your bug report. As Doug wrote in 2019, fuzzy logic doesn't depend on precise accuracy, so either calculation will work just fine. But to answer your question, trapz was used because we're finding the x-coordinate of the centroid of a region defined by a set of points, that is, the centroid of an area for which the x-axis is continuous, which is defined by a quotient of two integrals. For your example, the centroid is 4.0870. The calculation you give is for the centroid of discrete points, not a continuous area, but either is just fine, and in the limit, they should converge. It's interesting to note that matlab, according to its online documentation, uses your formula, which is likely also more efficient. In the next release, I'll offer both versions of the centroid defuzz method. Thanks again for your input.

L. Markowsky <lmarkov>
Thu 18 Feb 2021 02:26:14 AM UTC, comment #2: 

Add package maintainer to discussion.

Kai Torben Ohlhus <siko1056>
Group Member
Wed 27 Mar 2019 02:42:45 PM UTC, comment #1: 

As a general answer, not a specific answer ( I don't know why it was done this way). Fuzzy controllers are nonlinear controllers usually controlling nonlinear processes, and in practice this approximate method works just fine. Years ago we did not have as powerful CPUs and therefor the faster approximations were used. Try implementing a fuzzy controller in a microcontroller and you fill see that the faster method is desirable.
But like I said at the beginning, it is all non linear and perfect accuracy is not needed.

Doug Stewart <dastew>
Wed 27 Mar 2019 02:18:05 PM UTC, original submission:  


Why did you implement defuzz with an approximated approach (by means of the trapz integral) if an exact approach exist?

Consider the following example:

X=[3;4;5];
params=[1 4.5 5 6];
Y=trapmf(X,params);
defuzz(X,Y,'centroid')

which provides 4.1304, but the exact result is

X'*Y/sum(Y)

which is 4.1765.


Luis <lalucas_1967>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by lmarkov (Posted a comment)
  • -email is unavailable- added by siko1056 (Posted a comment)
  • -email is unavailable- added by siko1056 (Package maintainer)
  • -email is unavailable- added by dastew (Posted a comment)
  • -email is unavailable- added by lalucas_1967 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-02-18 siko1056 Carbon-Copy- Added -email is unavailable-
    2019-03-27 mtmiller Release5.1.0 dev
        Summarydefuzz provides inaccurate result [octave forge] (fuzzy-logic-toolkit) defuzz provides inaccurate result

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code