What correction need in this..? for fuzzy

1 visualización (últimos 30 días)
Lalit Patil
Lalit Patil el 24 de En. de 2013
function out = Tanvismembershipfunction(x, params)
for i=1:length(x)
if x(i)<params(1)
y(i)= 2 * abs(x(i) - 0.5);
elseif x(i)<params(2)
y(i)= 2 * abs(x(i) - 0.5);
else x(i)<params(3)
y(i)= 2 * abs(x(i) - 0.5);
end
out=.1*y'; % scaling the output to lie between 0 and 1

Respuesta aceptada

Walter Roberson
Walter Roberson el 24 de En. de 2013
There is no way to get that graph by just altering the params() values in that code.
Instead consider
y = 2 * abs(x - 0.5)
  2 comentarios
Lalit Patil
Lalit Patil el 24 de En. de 2013
Editada: Lalit Patil el 24 de En. de 2013
In my plot should be 3points..
In sequence at 1,0,1 on y-axis..
But i am getting like 0.1 0 0.1
I given parameters [0 0.5 1]
Range [0 1] , dispay range [0 1]
and i modified the code above..
Walter Roberson
Walter Roberson el 24 de En. de 2013
Change the 2 to 20 if you insist on using that function structure

Iniciar sesión para comentar.

Más respuestas (1)

Jing
Jing el 24 de En. de 2013
If you want to use it in a fuzzy logic/control problem, TRAPMF or TRIMF can easily create the function like that.
x=0:0.1:1;
y=1-trimf(x,[0 0.5 1]);
plot(x,y)
  1 comentario
Lalit Patil
Lalit Patil el 24 de En. de 2013
sorry, but i want to create the same thing without function...
x = 0:0.1:1
for i=1:length(x)
if x(i)<params(1)
y(i)= 2 * abs(x(i) - 0.5);
elseif x(i)<params(2)
y(i)= 2 * abs(x(i) - 0.5);
else x(i)<params(3)
y(i)= 2 * abs(x(i) - 0.5);
end
end
out=.1*y';
plot(x,out)
This works well in command window but not in fuzzy GUI... problem is mensioned in aboves answer..

Iniciar sesión para comentar.

Categorías

Más información sobre Fuzzy Logic Toolbox 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