Multi-Input Single Output Fuzzy Approximation of a Function.
fls=fuzzapp( order , domain_i , domain_o , partitions , f [,df] )
fls structure.
integer. 1 for first order, 2 for second order.
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.
row vector with two elements in the form [minDom maxDom]. minDom means the minimum value of the output, and maxDom the maximum value.
column vector with the number or partitions for each input. partitions(j) is the number of partitions for the j input.
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
function. The Jacobian of f. This function is required if order is equal to 2.
fuzzapp
create a Fuzzy Approximation for the function
f
.
// 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); scf();clf(); 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"); | ![]() | ![]() |