Pergunta

I am beginner. I have a matrix in matlab and I want Convert matrix's number to fuzzy number and use these fuzzy number for my function's input .how can I do this? is it correct to Convert number to double number between 0,1 by Dividing numbers by 1000 like this? [256,12;3,56]--->[0.256,0.12;0.003,0.056]

but for double number what should I do?

Foi útil?

Solução

What do you mean by fuzzy number?!! as far as I know MATLAB uses normal numbers for Fuzzy system. After that there are fuzzifiers that change the real numbers to the points on the membership functions. And then the fuzzy logic decides that how the number have to be selected, and so on...! On the other hand, If you want to change the scale of the number to be in the range [-1 1] or [0 1] then it has nothing to do with fuzzy.

and to change from the range [0 1] to [a b] use this line of code:

r = a + (b-a)*z;

where the z is in the range [0 1], and the r is in the range [a b]

for example, changing z=0.5 from [0 1] to the range [0 10], r becomes:

r = 0 + (10-0)*0.5 = 5

to change from [a b] to [0 1] also you can do this:

z = (r - a)/(b-a);

so if r = 5 in the range [0 10], then z = 0.5 in the range [0 1];

In addition, for the real fuzzy operation, try something like this:

point_n = 101;          % Determines MF's resolution

min_x = -20; max_x = 20;    % Universe is [min_x, max_x]

x = linspace(min_x, max_x, point_n)';

A = trapmf(x, [-10 -2 1 3]);    % Trapezoidal fuzzy set A
B = gaussmf(x, [2 5]);      % Gaussian fuzzy set B

C1 = fuzarith(x, A, B, 'sum');

subplot(2,1,1);
plot(x, A, 'b--', x, B, 'm:', x, C1, 'c');
title('fuzzy addition A+B');

C2 = fuzarith(x, A, B, 'sub');
subplot(2,1,2);
plot(x, A, 'b--', x, B, 'm:', x, C2, 'c');
title('fuzzy subtraction A-B');

C3 = fuzarith(x, A, B, 'prod');

That's how you perform fuzzy arithmetic. According to MathWorks:

Using interval arithmetic, C = fuzarith(X, A, B, operator) returns a fuzzy set C as the result of applying the function represented by the string, operator, which performs a binary operation on the sampled convex fuzzy sets A and B. The elements of A and B are derived from convex functions of the sampled universe, X:

  1. A, B, and X are vectors of the same dimension.
  2. operator is one of the following strings: 'sum', 'sub', 'prod', and 'div'.
  3. The returned fuzzy set C is a column vector with the same length as X.

And Finally you can perform fuzzy inference calculation using 'evalfis' function in MATLAB. The inputs and outputs to this function are real numbers as well:

fismat = readfis('tipper');
out = evalfis([2 1; 4 9],fismat)

This syntax generates the response

out =
    7.0169
    19.6810 
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top