Why do I keep getting a "griddedInterpolant" error when using the fuzarith function for inputted values which lie over two membership functions?

1 visualización (últimos 30 días)
At the moment I am using the fuzzy logic toolbox and some code I have written to produce plots of my fuzzy outputs and the crisp value. This all works completely fine until I enter input values which happen to lie in between two membership functions. For example "medium" might be 8000-14000 and "hard" is 12000-18000 so if I enter 12500 (for example) eventually the code breaks. It is able to produce the outputs for that particular function fine, but when I go to use the fuzarith function to multiply several of these fuzzy outputs together it breaks. Basically it does not like inputs of overlapping membership functions, but these have to overlap and inputs could lie in the overlap!
My error is:
Error using griddedInterpolant
The grid vectors must contain unique points.
It is breaking at the fuzarith function and my code for this is below, where outputRange is the x-axis and aggregatedOutput(n) is the y-axis for each fuzzy output "n" which is being multiplied together (n = 1-3 in my case):
A = fuzarith(outputRange, aggregatedOutput, aggregatedOutput2, 'prod');
B = fuzarith(outputRange, A, aggregatedOutput3, 'prod');
figure()
plot(outputRange, aggregatedOutput, 'c--', outputRange, aggregatedOutput2, 'g-.', outputRange, aggregatedOutput3, 'm:', outputRange, B, 'b', [out out], [0 1]); %plots the function of A*B
Apologies if I haven't explained this very well or included everything! I'm still super new to programming and potentially terrible at asking the right questions!

Respuestas (0)

Categorías

Más información sobre Fuzzy Logic in Simulink en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by