diff --git a/FFIS.m b/FFIS.m deleted file mode 100644 index 263d6be..0000000 --- a/FFIS.m +++ /dev/null @@ -1,182 +0,0 @@ -%% FFIS201210 -% FFIS.m is a function for the implementation of fractional fuzzy inference -% System -%% The reference -% Mehran Mazandarani, Li Xiu, Fractional Fuzzy Inference System: -% The New Generation of Fuzzy Inference Systems, -% IEEE Access, Vol. 8, pp. 126066-126082, 2020. -% DOI: 10.1109/ACCESS.2020.3008064 -% Link: https://ieeexplore.ieee.org/document/9136681 - -% If there is any question contact the authors of the above paper. -% Date of issue 2020-12-10 -% Before using FFIS.m read carefully the help file, help_FFIS.pdf. -% This program is the first version of the function FFIS.m (FFIS_201210) -% The algorith of this function has not been written in an optimal manner. -% Thus, naturally, it may take more time than that one may expect for -% getting the output. - - - - -function output=FFIS(fis,Inputs,Fids) - - -Nrules=max(size(fis.Rules)); -No_Inputs=size(fis.Inputs,2); - -% Initialization for the aggregation process -h_output=0.01; -output_range=fis.Output.Range; -% Discretizing the Range of output -y=linspace(output_range(1),output_range(2),diff(output_range)/h_output); - -out=zeros(1,numel(y)); - -% % % % % % % % % % - - -for i=1:Nrules - - TD=zeros(1,No_Inputs); - Input_MF_No=fis.Rules(i).Antecedent; - - for j=1:No_Inputs - Input_MF_Param=fis.Inputs(1,j).MembershipFunctions(1,Input_MF_No(j)).Parameters; - Input_MF_Type=fis.Inputs(1,j).MembershipFunctions(1,Input_MF_No(j)).Type; - Input_MF= fismf(Input_MF_Type,Input_MF_Param); - TD(j) = evalmf(Input_MF,Inputs(j)); - end - switch fis.AndMethod - case 'min' - Mu_star=min(TD); - otherwise - Mu_star=prod(TD); - end - - Output_MF_No=fis.Rules(i).Consequent; - - % % % The max operator for the Aggregation Method - - out=max(out,FTR(fis,Output_MF_No,Mu_star,y,Fids)); - -end -defuz=fis.DefuzzificationMethod; -% % % Defuzzification of the output -output = defuzz(y,out,defuz); - -%% Fractional Translation Rule - -function out=FTR(fis,Output_MF_No,Mu_star,y,Fids) - - -Output_MF_Param=fis.Outputs(1,1).MembershipFunctions(1,Output_MF_No).Parameters; -out=FMF(y,Output_MF_Param,Mu_star,Fids(2*Output_MF_No-1:2*Output_MF_No)); - -%% - -%% Fractional Membership Function -% This function works only for the triangular and trapezoidal membership -% functions. - -function out=FMF(y,Output_MF_Param,Mu_star,Fidx) - -Fidx_value=str2func(['@(x)',num2str(Fidx{1})]); -switch Fidx{2} - case {'b',1} - betta=Fidx_value(Mu_star); - cs=HMFunction_betta(Output_MF_Param,Mu_star,0); - bs=HMFunction_betta(Output_MF_Param,Mu_star,betta); - as=HMFunction_betta(Output_MF_Param,0,betta); - as=min(bs,as); - - if abs(cs-Output_MF_Param(end))<=10^(-8) - cs=Output_MF_Param(end); - end - - out=Mu_star*trapmf(y,[as,bs,cs,Output_MF_Param(end)]); - - case {'a',0} - alpha=Fidx_value(Mu_star); - bs=HMFunction_alpha(Output_MF_Param,Mu_star,0); - cs=HMFunction_alpha(Output_MF_Param,Mu_star,alpha); - ds=HMFunction_alpha(Output_MF_Param,0,alpha); - ds=max(cs,ds); - - if abs(bs-Output_MF_Param(1))<=10^(-8) - bs=Output_MF_Param(1); - end - - out=Mu_star*trapmf(y,[Output_MF_Param(1),bs,cs,ds]); - -end - -%% Fractional Horizontal MF (beta form) -function outgr=HMFunction_betta(Output_MF_Param,Mu_star,betta) - -s=numel(Output_MF_Param); -switch s - case 3 - a=Output_MF_Param(1); - b=Output_MF_Param(2); - c=Output_MF_Param(3); - - outgr=(a+(b-a)*Mu_star)+(1-Mu_star)*(c-a)*(1-betta); - - case 4 - a=Output_MF_Param(1); - b=Output_MF_Param(2); - c=Output_MF_Param(3); - d=Output_MF_Param(4); - - outgr=(a+(b-a)*Mu_star)+((d-a)-Mu_star*(d-a+b-c))*(1-betta); - -end - - - -end - -%% Fractional Horizontal MF (alpha form) -function outgr=HMFunction_alpha(Output_MF_Param,Mu_star,alpha) - -s=numel(Output_MF_Param); -switch s - case 3 - a=Output_MF_Param(1); - b=Output_MF_Param(2); - c=Output_MF_Param(3); - - outgr=(a+(b-a)*Mu_star)+(1-Mu_star)*(c-a)*alpha; - - case 4 - a=Output_MF_Param(1); - b=Output_MF_Param(2); - c=Output_MF_Param(3); - d=Output_MF_Param(4); - - outgr=(a+(b-a)*Mu_star)+((d-a)-Mu_star*(d-a+b-c))*alpha; - -end - - - -end - - -end - - - - - - -end - - - - - - - -end diff --git a/Help_FFIS201210.pdf b/Help_FFIS201210.pdf deleted file mode 100644 index 2fb8c24..0000000 Binary files a/Help_FFIS201210.pdf and /dev/null differ diff --git a/README.md b/README.md deleted file mode 100644 index c9e04ba..0000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -# Fuzzy-Logic-System diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..c419263 --- /dev/null +++ b/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-cayman \ No newline at end of file diff --git a/example.m b/example.m deleted file mode 100644 index 600aab3..0000000 --- a/example.m +++ /dev/null @@ -1,103 +0,0 @@ -%% The reference -% Mehran Mazandarani, Li Xiu, Fractional Fuzzy Inference System: -% The New Generation of Fuzzy Inference Systems, -% IEEE Access, Vol. 8, pp. 126066-126082, 2020. -% DOI: 10.1109/ACCESS.2020.3008064 -% Link: https://ieeexplore.ieee.org/document/9136681 - -% If there is any question contact the authors of the above paper. -% Date of issue 2020-12-10 -% Before using the this file and FFIS.m read carefully the help file, -% help_FFIS.pdf -%% The example of control of inverted pendulum system using FFIS -% This program is the first version of the function FFIS.m (FFIS_201210) -% The algorith of this function has not been written in an optimal manner. -% Thus, naturally, it may take more time than that one may expect for -% getting the output. -% Based on the settings in this example, it takes almost 7 minutes to get -% the output. - -%% Initialize the Fuzzy system structure (Initialization Section) -clc -clear -% close all - -fis=readfis('fis'); - -%% Fractional Indices -% Fids={value_1,form_1, value_2,form_2,...,value_m,form_m} -% Read the help_FFIS.pdf for more information about the cell arraye Fids. - -% fis.Outputs.MembershipFunctions - -% In this example the following indices have been considered arbitrary. - Fids={0.5, 'a', 0.5, 'a', 1,'a', 0.5, 'b', 0.5,'b'}; - -% For Mamdani's FIS -% Fids={1, 'a', 1, 'b', 1,'a', 1, 'b', 1,'b'}; - -%% Model (The main section) - - - - -T=3; -n=2000; -tspan=linspace(0,T,n+1); -h=tspan(2)-tspan(1); - -% % This is the gain of control signal based on the control structure. -Kgain=220; - -% % % % Pendulum parameters -g=9.8; -m=2; -M=8; -l=2; -% x1 is the angle of the pendulum and is used as the error -% x2 is the derivative of the x1, i.e. the derivative of the error -% % % % % % % % % % % % % % % % % % -% x1=theta; -% x2=theta_dot; -x1=zeros(1,n+1); -x2=zeros(1,n+1); -u=zeros(1,n); -x1(1)=0.3; % the initial condition -x2(1)=0.1; % the initial condition -a=1/(M+m); - -% Model part -for cnt=1:n - -Inputs=[x1(cnt); x2(cnt)]; - -% % % the control signal -u(cnt)=FFIS(fis,Inputs,Fids); - -u(cnt)=Kgain*u(cnt); - -% % The model has been considered in a descrete form by the use of -% % forward approximation of the derivative definition. - -x1(cnt+1)=x1(cnt)+h*x2(cnt); -k1=g*sin(x1(cnt))-a*m*l*x2(cnt)^2*sin(2*x1(cnt))/2-a*cos(x1(cnt))*u(cnt); -k2=4*l/3-a*m*l*cos(x1(cnt))^2; -x2(cnt+1)=x2(cnt)+h*k1/k2; - -end - - -figure(1) -plot(tspan(1:numel(x1)),x1,'LineWidth',2) -grid on -hold on -figure(2) -plot(tspan(1:numel(u)),u/Kgain,'LineWidth',2) -grid on -hold on - - - - - - diff --git a/fis.fis b/fis.fis deleted file mode 100644 index fdc178d..0000000 --- a/fis.fis +++ /dev/null @@ -1,69 +0,0 @@ -[System] -Name='fis' -Type='mamdani' -Version=2.0 -NumInputs=2 -NumOutputs=1 -NumRules=25 -AndMethod='min' -OrMethod='max' -ImpMethod='min' -AggMethod='max' -DefuzzMethod='centroid' - -[Input1] -Name='error' -Range=[-1 1] -NumMFs=5 -MF1='NB':'trapmf',[-1 -1 -0.5 -0.05] -MF2='NM':'trimf',[-0.5 -0.05 0] -MF3='Z':'trimf',[-0.05 0 0.05] -MF4='PM':'trimf',[0 0.05 0.5] -MF5='PB':'trapmf',[0.05 0.5 1 1] - -[Input2] -Name='diverror' -Range=[-1 1] -NumMFs=5 -MF1='NB':'trapmf',[-1 -1 -0.5 -0.1] -MF2='NM':'trimf',[-0.5 -0.1 0] -MF3='Z':'trimf',[-0.1 0 0.1] -MF4='PM':'trimf',[0 0.1 0.5] -MF5='PB':'trapmf',[0.1 0.5 1 1] - -[Output1] -Name='control' -Range=[-2 2] -NumMFs=5 -MF1='NB':'trapmf',[-2 -2 -0.6 -0.01] -MF2='NS':'trimf',[-0.6 -0.01 0] -MF3='Z':'trimf',[-0.01 0 0.01] -MF4='PS':'trimf',[0 0.01 0.6] -MF5='PB':'trapmf',[0.01 0.6 2 2] - -[Rules] -5 5, 5 (1) : 1 -5 4, 5 (1) : 1 -5 3, 5 (1) : 1 -5 2, 4 (1) : 1 -5 1, 3 (1) : 1 -4 5, 5 (1) : 1 -4 4, 5 (1) : 1 -4 3, 4 (1) : 1 -4 2, 3 (1) : 1 -4 1, 2 (1) : 1 -3 5, 5 (1) : 1 -3 4, 4 (1) : 1 -3 3, 3 (1) : 1 -3 2, 2 (1) : 1 -3 1, 1 (1) : 1 -2 5, 4 (1) : 1 -2 4, 3 (1) : 1 -2 3, 2 (1) : 1 -2 2, 1 (1) : 1 -2 1, 1 (1) : 1 -1 5, 3 (1) : 1 -1 4, 2 (1) : 1 -1 3, 1 (1) : 1 -1 2, 1 (1) : 1 -1 1, 1 (1) : 1 diff --git a/index.md b/index.md new file mode 100644 index 0000000..583c39f --- /dev/null +++ b/index.md @@ -0,0 +1,37 @@ +## Welcome to GitHub Pages + +You can use the [editor on GitHub](https://github.com/me-mazandarani/Fractional-Fuzzy-Logic-System/edit/gh-pages/index.md) to maintain and preview the content for your website in Markdown files. + +Whenever you commit to this repository, GitHub Pages will run [Jekyll](https://jekyllrb.com/) to rebuild the pages in your site, from the content in your Markdown files. + +### Markdown + +Markdown is a lightweight and easy-to-use syntax for styling your writing. It includes conventions for + +```markdown +Syntax highlighted code block + +# Header 1 +## Header 2 +### Header 3 + +- Bulleted +- List + +1. Numbered +2. List + +**Bold** and _Italic_ and `Code` text + +[Link](url) and ![Image](src) +``` + +For more details see [GitHub Flavored Markdown](https://guides.github.com/features/mastering-markdown/). + +### Jekyll Themes + +Your Pages site will use the layout and styles from the Jekyll theme you have selected in your [repository settings](https://github.com/me-mazandarani/Fractional-Fuzzy-Logic-System/settings/pages). The name of this theme is saved in the Jekyll `_config.yml` configuration file. + +### Support or Contact + +Having trouble with Pages? Check out our [documentation](https://docs.github.com/categories/github-pages-basics/) or [contact support](https://support.github.com/contact) and we’ll help you sort it out. diff --git a/license.txt b/license.txt deleted file mode 100644 index 4b6f315..0000000 --- a/license.txt +++ /dev/null @@ -1,25 +0,0 @@ -Copyright (c) 2020, Mehran Mazandarani -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution -* Neither the name of nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.