function
fuzzapp - Multi-Input Single Output Fuzzy
Approximation of a Function.
Calling Sequence
-
fls=fuzzapp( order , domain_i , domain_o ,
partitions , f [,df] )
Parameters
-
fls
: fls structure.
-
order
: integer.
1
for first order,
2
for
second order.
-
domain_i
: matrix of real with dimensions
[ninputs,2]
, were
ninputs
mean the number of inputs. Each row have two
elements in the form
[minDom maxDom]
, where
minDom
meand the minimum value who take the input, and
maxDom
the maximum value.
-
domain_o
: row vector with two elements in the form
[minDom
maxDom]
.
minDom
means the minimum value of the
output, and
maxDom
the maximum value.
-
partitions
: column vector with the number or partitions for each input.
partitions(j)
is the number of partitions for the
j
input.
-
f
: function. The function to approximate. The result of
f
must be a scalar.This function must be vectorized,
y=f(X)
where
X=[value1 , value2 , .... ,
value_ni] , ni=number of inputs
-
df
: function. The Jacobian of f. This function is required if
order is equal to 2.
Description
fuzzapp
create a Fuzzy Approximation for the function
f
.
Examples
// The function to approximate
deff("y=f(x)","y=sin(x)");
fls=fuzzapp(1,[-%pi %pi],[-1 1],10,f);
x=linspace(-%pi,%pi,100)';
Y_real=f(x);
Y_fuzz=evalfls(x,fls);
xbasc();
subplot(2,1,1);
plot2d(x,[Y_real Y_fuzz],leg="real@approximation");
xtitle("Fuzzy Approximation","x","y=f(x)");
subplot(2,1,2);
plot2d(x,abs(Y_real-Y_fuzz));
xtitle("Approximation Error","x","error");
Author
Jaime Urzua Grez