LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Fuzzy logic toolbox in Matlab and Labview produce different results

I have been doing some work with fuzzy logic toolbox in Matlab. The fuzzy inference system (FIS) built in Matlab environment is quite simple and straightforward. An example of the FIS in Matlab can be found in the attachment. Now I want to use the fuzzy logic toolkit from Labview to perform the same task. An example of the FIS in Labview can also be found attached. Although the FIS properties in Labview has been made the same as in Matlab, the result of the defuzzification is different. The FIS properties in Matlab are:
And method: prod
Or method: max
Implication: Prod
Aggregation: Sum
Defuzzification: Centroid
 
The FIS properties in Labview has been made:
Defuzzification Method: Center of Gravitiy (which is another name for Centroid)
If no rule is active: Take last value
Inference Method: Max-Min
Select form of rulebase: Normal rulebase
 
For instance, if the input to FIS is Matlab is -3.51, the output is 0.202. However, with the same input, the output from FIS in Labview is 0.30.
 
Perhaps anyone can help me?
0 Kudos
Message 1 of 4
(4,251 Views)

Hi

If you have a look at your LabVIEW VI you are actually getting an error (error 1047) I think this is why you are getting different values in LabVIEW than matlab. If you have a look at the KB I have attached I think it will sort out you problem.

Why Do I Get Error 1047 When Trying to Use The MATLAB Script Node in LabVIEW?

http://digital.ni.com/public.nsf/websearch/2B3FF46C8512C4F786256CF30071BE53?OpenDocument

 

If you are still experiencing difficulties after you have run through the KB solution please let me know

 

I have also noticed you have posted on another thread with the same issue I have added a link just to tie them together

http://forums.ni.com/ni/board/message?board.id=170&message.id=180014

 

Regards

 

Tim

 

NI AE UK and Ireland

0 Kudos
Message 2 of 4
(4,228 Views)
Hi Tim,
actually I have posted two different threads. This thread is concerned with the values produced by Labview and Matlab fuzzy logic toolbox/toolkit. The other thread is about using Matlab node inside Labview program.
 
As I explained in my previous questions, I have set the same parameters for both the fuzzy logic in Labview and in Matlab. But the results (after defuzzification) are not the same. I have included the fuzzy logic files for you to have a look. I did not get any error message when I run a Labview program which includes the fuzzy logic.vi. Do you have any idea what is wrong?
 
Dedy
 
 
 
 
0 Kudos
Message 3 of 4
(4,217 Views)

Hi Dedy

 

I was wondering if you could send me some more points and results for both matlab and LabVIEW. I don’t know how matlab rounds numbers but there could be a difference in the way that matlab and LabVIEW handles umbers. If one handles the numbers as a U32 and the other as a U16 there could be a big difference in rounding depending with what you are doing with the data.

 

If you could give me some out puts for numbers -10 to 10 with increments of say .1 and -1 to 1 incrementing at 0.01 (basically as much information as you can ) then I can have a look at it. If it looks like an off set then it might just be a setting if it looks like a rounding problem it could be a compatibility issue.

 

You said that you are getting different values do you which one if any is the right answer?

 

Regards

 

Tim

 

Applications Engineer | National Instruments | UK & Ireland

0 Kudos
Message 4 of 4
(4,198 Views)