Kindly share the final code to run?

Write a MATLAB program to plot the LR MF.
Kindly share the final code to run in MATLAB.

Antworten (1)

Walter Roberson
Walter Roberson am 28 Mär. 2021

1 Stimme

https://www.mathworks.com/matlabcentral/fileexchange/2173-neuro-fuzzy-and-soft-computing has the code in it... somewhere. (I tracked it down there four years ago.)

2 Kommentare

Prakul Jain
Prakul Jain am 28 Mär. 2021
Bearbeitet: Walter Roberson am 28 Mär. 2021
function y = lr_mf(x, parameter)
%LR_MF Left-right membership function with 3 parameters.
% J.-S. Roger Jang, 1993
c = parameter(1); alpha = parameter(2); beta = parameter(3);
index1 = find(x < c);
index2 = find(x >= c);
x1 = (c - x(index1))/alpha;
x2 = (x(index2) - c)/beta;
y1 = sqrt(max(1-x1.*x1, zeros(size(x1))));
y2 = exp(-abs(x2.*x2.*x2));
if size(x, 1) == 1,
y = [y1 y2];
else
y = [y1; y2];
end
What should I replace to run it?
Walter Roberson
Walter Roberson am 28 Mär. 2021
That looks appropriate. You would call the function, passing in x values and the parameter vector, and you would store the output in a variable, and after that you would plot() the x values and the results of the call.

Melden Sie sich an, um zu kommentieren.

Kategorien

Tags

Gefragt:

am 28 Mär. 2021

Kommentiert:

am 28 Mär. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by