Ahmad Fajar Nugroho (12518241040).pdf

15
  Laporan Praktikum SISTEM KENDALI CERDAS CRISP SETS DAN FUZZY SETS Oleh: Ahmad Fajar Nugroho (12518241040) I. Tujuan Menentukan identitas dasar dalam fuzzy sets . II. Hasil dan Analisis Modul sqrmf : % modul sqrmf.m function [val] = sqrmf(x,a,b ) val = max(min(min((x-a)/0.001,(b-x)/0.001),1),0); return; Modul gbellmf : % modul gbellmf.m function [y] = gbellmf(x,a,b,c) y = 1./(1+(((x-c)/a).^2).^b); return; Modul Crisp sets dan Fuzzy set x=0:10:600; %semesta (kedalaman laut)  %crisp sets A=sqrmf(x,0,200); B=sqrmf(x,200,400);  C=sqrmf(x,400,600);  %fuzzy sets Az=gbellmf(x,60,2.5,100);  Bz=gbellmf(x,60,2.5,300);  Cz=gbellmf(x,60,2.5,500);  

Transcript of Ahmad Fajar Nugroho (12518241040).pdf

  • Laporan Praktikum

    SISTEM KENDALI CERDAS

    CRISP SETS DAN FUZZY SETS

    Oleh:

    Ahmad Fajar Nugroho (12518241040)

    I. Tujuan

    Menentukan identitas dasar dalam fuzzy sets.

    II. Hasil dan Analisis

    Modul sqrmf :

    % modul sqrmf.m

    function [val] = sqrmf(x,a,b)

    val = max(min(min((x-a)/0.001,(b-x)/0.001),1),0);

    return;

    Modul gbellmf :

    % modul gbellmf.m

    function [y] = gbellmf(x,a,b,c)

    y = 1./(1+(((x-c)/a).^2).^b);

    return;

    Modul Crisp sets dan Fuzzy set

    x=0:10:600; %semesta (kedalaman laut)

    %crisp sets

    A=sqrmf(x,0,200);

    B=sqrmf(x,200,400);

    C=sqrmf(x,400,600);

    %fuzzy sets

    Az=gbellmf(x,60,2.5,100);

    Bz=gbellmf(x,60,2.5,300);

    Cz=gbellmf(x,60,2.5,500);

  • %Crisp Sets and Fuzzy Sets (Set A, Set B, And Set C)

    figure(1)

    clf

    hold on

    grid on

    plot(x,A,'g--',x,B,'y--',x,C,'r--',x,Az,'g',x,Bz,'y',x,Cz,'r');

    axis([-inf inf 0 1.2]);

    title('Fuzzy dan Crisp Sets (Kedalaman Laut)');

    ylabel('Nilai Himpunan Fuzzy');

    text(87,1.1,'Dangkal'); text(288,1.1,'Sedang'); text(490,1.1,'Dalam');

    hold off

    Figure 1, Set nilai Fuzzy dan Crisp sets

    Sub Modul 2 : Contradiction and Excluded Middle

    %Contradiction and Excluded Middle

    figure(2)

    clf

    hold on

  • subplot(221)

    plot(x,A,'--',x,1-A,'-.',x,min(A,1-A),'r');

    axis ([-inf inf 0 1.2]);

    title('A And (Not A)');

    subplot(222)

    plot(x,Az,'--',x,1-Az,'-.',x,min(Az,1-Az),'r');

    axis ([-inf inf 0 1.2]);

    title('A And (Not A)');

    subplot(223)

    plot(x,A,'--',x,1-A,'-.',x,max(A,1-A),'r');

    axis ([-inf inf 0 1.2]);

    title('A Or (Not A)');

    subplot(224)

    plot(x,Az,'--',x,1-Az,'-.',x,max(Az,1-Az),'r');

    axis ([-inf inf 0 1.2]);

    title('A Or (Not A)');

    hold off

  • Figure 2, Contradiction and Excluded Middle

    Sub Modul 3 : Indempotency Law

    %Indempotency Law

    figure(3)

    clf

    hold on

    subplot(221)

    plot(x,A,'b',x,Az,'r');

    axis([-inf inf 0 1.2]);

    title('A');

    set(gca ,'xtick', [0 200 400 600]);

    subplot(222)

    plot(x,min(A,A),'b',x,min(Az,Az),'r');

    axis([-inf inf 0 1.2]);

    title('A and A');

  • set(gca ,'xtick', [0 200 400 600]);

    subplot(223)

    plot(x,max(A,A),'b',x,max(Az,Az),'r');

    axis([-inf inf 0 1.2]);

    title('A or A');

    set(gca ,'xtick', [0 200 400 600]);

    subplot(224)

    plot(x,1-(1-A),'b',x,1-(1-Az),'r');

    axis([-inf inf 0 1.2]);

    title('Not (Not A)');

    set(gca ,'xtick', [0 200 400 600]);

    hold off

    Figure 3, Indempotency Law

  • Sub Modul 4 : Comutative Law

    % Comutative Law

    figure(4)

    clf

    hold on

    subplot(221)

    plot(x,min(A,B),'b',x,min(Az,Bz),'r');

    axis([-inf inf 0 1.2]);

    title('A and B');

    set(gca ,'xtick', [0 200 400 600]);

    subplot(222)

    plot(x,min(B,A),'b',x,min(Bz,Az),'r');

    axis([-inf inf 0 1.2]);

    title('B and A');

    set(gca ,'xtick', [0 200 400 600]);

    subplot(223)

    plot(x,max(A,B),'b',x,max(Az,Bz),'r');

    axis([-inf inf 0 1.2]);

    title('A or B');

    set(gca ,'xtick', [0 200 400 600]);

    subplot(224)

    plot(x,max(B,A),'b',x,max(Bz,Az),'r');

    axis([-inf inf 0 1.2]);

    title('B or A');

    set(gca ,'xtick', [0 200 400 600]);

    hold off

  • Figure 4, Comutative Law

    Sub Modul 5 : Associative Law

    %Associative Law

    figure(5)

    clf

    hold on

    subplot(221)

    plot(x,min(min(A,B),C),'b',x,min(min(Az,Bz),Cz),'r');

    axis([-inf inf 0 1.2]);

    title('(A and B) and C');

    set(gca ,'xtick', [0 200 400 600]);

    subplot(222)

    plot(x,min(A,min(B,C)),'b',x,min(Az,min(Bz,Cz)),'r');

    axis([-inf inf 0 1.2]);

    title('A and (B and C)');

    set(gca ,'xtick', [0 200 400 600]);

  • subplot(223)

    plot(x,max(max(A,B),C),'b',x,max(max(Az,Bz),Cz),'r');

    axis([-inf inf 0 1.2]);

    title('(A or B) or C');

    set(gca ,'xtick', [0 200 400 600]);

    subplot(224)

    plot(x,max(A,max(B,C)),'b',x,max(Az,max(Bz,Cz)),'r');

    axis([-inf inf 0 1.2]);

    title('A or (B or C)');

    set(gca ,'xtick', [0 200 400 600]);

    hold off

    Figure 5, Associative Law

  • Sub Modul 6 : Distributive Law

    %Distributive Law

    figure(6)

    clf

    hold on

    subplot(221)

    plot(x,max(A,min(B,C)),'b',x,max(Az,min(Bz,Cz)),'r');

    axis([-inf inf 0 1.2]);

    title('(A or B) and C');

    set(gca ,'xtick', [0 200 400 600]);

    subplot(222)

    plot(x,min(max(A,B),max(A,C)),'b',x,min(max(Az,Bz),max(Az,Cz)),'r');

    axis([-inf inf 0 1.2]);

    title('(A or B) and (A or C)');

    set(gca ,'xtick', [0 200 400 600]);

    subplot(223)

    plot(x,min(A,max(B,C)),'b',x,min(Az,max(Bz,Cz)),'r');

    axis([-inf inf 0 1.2]);

    title('A and (B or C)');

    set(gca ,'xtick', [0 200 400 600]);

    subplot(224)

    plot(x,max(min(A,B),min(A,C)),'b',x,max(min(Az,Bz),min(Az,Cz)),'r');

    axis([-inf inf 0 1.2]);

    title('(A and B) or (A and C)');

    set(gca ,'xtick', [0 200 400 600]);

    hold off

  • Figure 6, Distributive Law

    Sub Modul 7 : Absorption Law

    %Abrsorption

    figure(7)

    clf

    hold on

    subplot(221)

    plot(x,A,'b',x,Az,'r');

    axis([-inf inf 0 1.2]);

    title('A');

    set(gca, 'xtick', [ 0 200 400 600]);

    subplot(222)

    plot(x,max(A,min(A,B)),'b',x,max(Az,min(Az,Bz)),'r');

    axis([-inf inf 0 1.2]);

  • title('A or (A and B)');

    set(gca, 'xtick', [ 0 200 400 600]);

    subplot(223)

    plot(x,A,'b',x,Az,'r');

    axis([-inf inf 0 1.2]);

    title('A');

    set(gca, 'xtick', [ 0 200 400 600]);

    subplot(224)

    plot(x,min(A,max(A,B)),'b',x,min(Az,max(Az,Bz)),'r');

    axis([-inf inf 0 1.2]);

    title('A and (A or B)');

    set(gca, 'xtick', [ 0 200 400 600]);

    hold off

    Figure 7, Absorption Law

  • Sub Modul 8 : Absorption of Complement Law

    %Absorbtion of complement

    figure(8)

    clf

    hold on

    subplot(221)

    plot(x,max(A,min((1-A),B)),'b',x,max(Az,min((1-Az),Bz)),'r');

    axis([-inf inf 0 1.2]);

    title('A or (Not A and B)');

    set(gca, 'xtick', [ 0 200 400 600]);

    subplot(222)

    plot(x,max(A,B),'b',x,max(Az,Bz),'r');

    axis([-inf inf 0 1.2]);

    title('A or B');

    set(gca, 'xtick', [ 0 200 400 600]);

    subplot(223)

    plot(x,min(A,max((1-A),B)),'b',x,min(Az,max((1-Az),Bz)),'r');

    axis([-inf inf 0 1.2]);

    title('A and (Not A or B)');

    set(gca, 'xtick', [ 0 200 400 600]);

    subplot(224)

    plot(x,min(A,B),'b',x,min(Az,Bz),'r');

    axis([-inf inf 0 1.2]);

    title('A and B');

    set(gca, 'xtick', [ 0 200 400 600]);

    hold off

  • Figure 8, Absorption of Complement Law

    Sub Modul 9 : DeMorgan Law

    %DeMorgan

    figure(9)

    clf

    hold on

    subplot(221)

    plot(x,1-max(A,B),'b',x,1-max(Az,Bz),'r');

    axis([-inf inf 0 1.2]);

    title('Not (A or B)');

    set(gca, 'xtick', [ 0 200 400 600]);

    subplot(222)

    plot(x,min(1-A,1-B),'b',x,min(1-Az,1-Bz),'r');

    axis([-inf inf 0 1.2]);

  • title('(Not A) and (Not B)');

    set(gca, 'xtick', [ 0 200 400 600]);

    subplot(223)

    plot(x,1-min(A,B),'b',x,1-min(Az,Bz),'r');

    axis([-inf inf 0 1.2]);

    title('Not (A and B)');

    set(gca, 'xtick', [ 0 200 400 600]);

    subplot(224)

    plot(x,max(1-A,1-B),'b',x,max(1-Az,1-Bz),'r');

    axis([-inf inf 0 1.2]);

    title('(Not A) or (Not B)');

    set(gca, 'xtick', [ 0 200 400 600]);

    hold off

    Figure 9, DeMorgan law

  • III. Kesimpulan

    Dari hasil praktikum di atas, gambar 8, pada bagian 3 dan 4 tidak dapat dipakai karena kurva

    yang dihasilan tidak sama, sedangkan pada sub modul dan figur lainnya, masing-masing

    memiliki kesamaan pada perbandingan himpunan sesuai dengan hukum yang terdapat

    pada modul 1 (fuzzy set dan crips set).