Wednesday, February 28, 2018

Tapis FIR Berbasis Pencuplikan Frekuensi dan Implementasinya Pada Sinyal Audio


Antarmuka GUI MATLAB ini dapat dipakai untuk laboratorium sinyal bagi mahasiswa dan untuk menunjang penelitian bagi para peneliti. Anda bisa memesannya pada form pemesanan di bawah ini.











KODE UNTUK SALAH SATU EVENT CALLBACK:


% --- Executes on button press in Lowpass.
function Lowpass_Callback(hObject, eventdata, handles)
% hObject    handle to Lowpass (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global x;

% Membaca semua parameter tapis
omega1s = str2num(get(handles.omega1s,'String'));
omega2s = str2num(get(handles.omega2s,'String'));
omega1p = str2num(get(handles.omega1p,'String'));
omega2p = str2num(get(handles.omega2p,'String'));
A1s = str2num(get(handles.A1s,'String'));
A2s = str2num(get(handles.A2s,'String'));
R1p = str2num(get(handles.R1p,'String'));
R2p = str2num(get(handles.R2p,'String'));

%Mengalikan dengan pi
%omega1s = omega1s * pi;
%omega1p = omega1p * pi;
%omega2s = omega2s * pi;
%omega2p = omega2p * pi;

if(omega1s > omega1p)

M=60; alpha=(M-1)/2; l=0:M-1; w1=(2*pi/M)*l;

%Membaca nilai slider
nilaiSlider = get(handles.slider1,'Value');

% Respon amplitudo ideal tercuplik
Hrs=[ones(1,3+nilaiSlider),0.5925,0.1099,zeros(1,47-nilaiSlider),0.1099,0.5925,ones(1,6)];

% respon amplitudo ideal
Hdr=[1,1,0,0]; wd1=[0,omega1p,omega1s,1]; 

k1=0:floor((M-1)/2); k2=floor((M-1)/2)+1:M-1;
angH=[-alpha*(2*pi)/M*k1, alpha*(2*pi)/M*(M-k2)];
H=Hrs.*exp(j*angH);

%Respon aktual
h=real(ifft(H,M));
[db,mag,pha,grd,w]=freqz_m(h,1);

[Hr,ww,a,L]=Hr_Tipe2(h);


%Menampilkan sampel-sampel frekuensi
axes(handles.axes7);
plot(w1(1:M/2)/pi, Hrs(1:M/2), 'o', wd1/2, Hdr,'color','r');
axis([0,1,-0.1,1.1]); title('Sampel-sampel frekuensi: M=60')
xlabel('frekuensi dalam unit pi'); ylabel('Hr(k)')
set(gca,'color',[0,0,0]);

%Menampilkan respon impuls
axes(handles.axes8);
stem(l,h,'color','r');
axis([-1,M,-0.1,0.4]); title('Respon impuls')
xlabel('frekuensi dalam unit pi'); ylabel('h(n)')
set(gca,'color',[0,0,0]);

%Menampilkan respon amplitudo
axes(handles.axes9);
plot(ww/pi, Hr, w1(1:M/2)/pi, Hrs(1:M/2), 'o','color','r');
axis([0,1,-0.2,1.2]); title('Respon amplitudo')
xlabel('frekuensi dalam unit pi'); ylabel('Hr(w)')
set(gca,'color',[0,0,0]);

%Menampilkan magnitudo dalam dB
axes(handles.axes3);
plot(w/pi, db,'color','r', 'LineWidth' ,2);
axis([0,1,-90,10]); title('Respon magnitudo')
xlabel('frekuensi dalam unit pi'); ylabel('dB')
set(gca,'color',[0,0,0]);

% Menghitung Hasil Penapisan
y = conv(double(x),double(h), 'same');
axes(handles.axes2); 
t = 0:length(y)-1;  %vektor indeks
stem(t,y,'linewidth',1,'color','y');title('Keluaran Tapis')
set(gca,'color',[0,0,0]);

else
    h = msgbox('Omega1s Harus Lebih Besar dari Omega1p');
end

%Menyimpan data global
global lowpass
lowpass = h;

%axes(handles.axes3)
%specgram(y, 8, 8);
%title('Spektrum Sinyal');
%set(gca,'color',[0,0,0]);


Tuesday, February 27, 2018

Tapis FIR Fase Linier Simetris-Genap Untuk Sinyal Audio Digital



Antarmuka GUI MATLAB ini dapat dipakai untuk laboratorium sinyal bagi mahasiswa dan untuk menunjang penelitian bagi para peneliti. Anda bisa memesannya pada form pemesanan di bawah ini.












KODE UNTUK SALAH SATU EVENT CALLBACK:

% --- Executes on button press in Tipe_2.
function Tipe_2_Callback(hObject, eventdata, handles)
% hObject    handle to Tipe_2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global x;

% Membaca semua koefisien tapis parallel
h3 = str2num(get(handles.h3,'String'));
h4 = str2num(get(handles.h4,'String'));
h1 = str2num(get(handles.h1,'String'));
h2 = str2num(get(handles.h2,'String'));
h0 = str2num(get(handles.h0,'String'));
h6 = str2num(get(handles.h6,'String'));
h5 = str2num(get(handles.h5,'String'));
h7 = str2num(get(handles.h7,'String'));
h8 = str2num(get(handles.h8,'String'));
h9 = str2num(get(handles.h9,'String'));
h10 = str2num(get(handles.h10,'String'));
h11 = str2num(get(handles.h11,'String'));

h = [h0 h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11];

%Menghitung tipe-2
M = length(h); n = 0:M-1;
[Hr,w,a,L] = Hr_Tipe2(h);
length(n),L

amax = max(a)+1; amin = min(a)-1;
axes(handles.axes7);
stem(n,h,'color','r'); axis([-1 2*L+1 amin amax])
set(gca,'color',[0,0,0]);
xlabel('n'); ylabel('h(n)'); title('Tanggapan Impuls')

axes(handles.axes8);
stem(1:L,a, 'color','r'); axis([-1 2*L+1 amin amax])
xlabel('n'); ylabel('a(n)'); title('koefisien-koefisien a(n)')
set(gca,'color',[0,0,0]);

axes(handles.axes9);
plot(w/pi,Hr,'color','r');grid
xlabel('frekuensi dalam unit pi'); xlabel('Hr')
title('Tanggapan Amplitudo Tipe-1')
set(gca,'color',[0,0,0]);

% Menghitung Hasil Penapisan
y = conv(double(x),double(a), 'same');

axes(handles.axes2); 
t = 0:length(y)-1;  %vektor indeks
stem(t,y,'linewidth',1,'color','y');title('Keluaran Tapis')
set(gca,'color',[0,0,0]);

axes(handles.axes3)
specgram(y, 8, 8);
title('Spektrum Sinyal');
set(gca,'color',[0,0,0]);


Tapis FIR Fase Linier Ganjil Untuk Sinyal Audio Digital


Antarmuka GUI MATLAB ini dapat dipakai untuk laboratorium sinyal bagi mahasiswa dan untuk menunjang penelitian bagi para peneliti. Anda bisa memesannya pada form pemesanan di bawah ini.











KODE UNTUK SALAH SATU EVENT CALLBACK:



% --- Executes on button press in Tipe_1.
function Tipe_1_Callback(hObject, eventdata, handles)
% hObject    handle to Tipe_1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global x;

% Membaca semua koefisien tapis parallel
h3 = str2num(get(handles.h3,'String'));
h4 = str2num(get(handles.h4,'String'));
h1 = str2num(get(handles.h1,'String'));
h2 = str2num(get(handles.h2,'String'));
h0 = str2num(get(handles.h0,'String'));
h6 = str2num(get(handles.h6,'String'));
h5 = str2num(get(handles.h5,'String'));
h7 = str2num(get(handles.h7,'String'));
h8 = str2num(get(handles.h8,'String'));
h9 = str2num(get(handles.h9,'String'));
h10 = str2num(get(handles.h10,'String'));

h = [h0 h1 h2 h3 h4 h5 h6 h7 h8 h9 h10];

%Menghitung tipe-1
M = length(h); n = 0:M-1;
[Hr,w,a,L] = Hr_Tipe1(h);

amax = max(a)+1; amin = min(a)-1;
axes(handles.axes7);
stem(n,h,'color','r'); axis([-1 2*L+1 amin amax])
set(gca,'color',[0,0,0]);
xlabel('n'); ylabel('h(n)'); title('Tanggapan Impuls')

axes(handles.axes8);
stem(0:L,a, 'color','r'); axis([-1 2*L+1 amin amax])
xlabel('n'); ylabel('a(n)'); title('koefisien-koefisien a(n)')
set(gca,'color',[0,0,0]);

axes(handles.axes9);
plot(w/pi,Hr,'color','r');grid
xlabel('frekuensi dalam unit pi'); xlabel('Hr')
title('Tanggapan Amplitudo Tipe-1')
set(gca,'color',[0,0,0]);


% Menghitung Hasil Penapisan
y = conv(double(x),double(a), 'same');

axes(handles.axes2); 
t = 0:length(y)-1;  %vektor indeks
stem(t,y,'linewidth',1,'color','y');title('Keluaran Tapis')
set(gca,'color',[0,0,0]);

axes(handles.axes3)
specgram(y, 8, 8);
title('Spektrum Sinyal');
set(gca,'color',[0,0,0]);


% --- Executes on button press in pushbutton18.
function pushbutton18_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton18 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global x;

% Membaca semua koefisien tapis parallel
h3 = str2num(get(handles.h3,'String'));
h4 = str2num(get(handles.h4,'String'));
h1 = str2num(get(handles.h1,'String'));
h2 = str2num(get(handles.h2,'String'));
h0 = str2num(get(handles.h0,'String'));
h6 = str2num(get(handles.h6,'String'));
h5 = str2num(get(handles.h5,'String'));
h7 = str2num(get(handles.h7,'String'));
h8 = str2num(get(handles.h8,'String'));
h9 = str2num(get(handles.h9,'String'));
h10 = str2num(get(handles.h10,'String'));

h = [h0 h1 h2 h3 h4 h5 h6 h7 h8 h9 h10];

%Menghitung tipe-2
M = length(h); n = 0:M-1;
[Hr,w,a,L] = Hr_Tipe2(h);
length(n),L

amax = max(a)+1; amin = min(a)-1;
axes(handles.axes7);
stem(n,h,'color','r'); axis([-1 2*L+1 amin amax])
set(gca,'color',[0,0,0]);
xlabel('n'); ylabel('h(n)'); title('Tanggapan Impuls')

axes(handles.axes8);
stem(1:L,a, 'color','r'); axis([-1 2*L+1 amin amax])
xlabel('n'); ylabel('a(n)'); title('koefisien-koefisien a(n)')
set(gca,'color',[0,0,0]);

axes(handles.axes9);
plot(w/pi,Hr,'color','r');grid
xlabel('frekuensi dalam unit pi'); xlabel('Hr')
title('Tanggapan Amplitudo Tipe-1')
set(gca,'color',[0,0,0]);

% Menghitung Hasil Penapisan
y = conv(double(x),double(a), 'same');

axes(handles.axes2); 
t = 0:length(y)-1;  %vektor indeks
stem(t,y,'linewidth',1,'color','y');title('Keluaran Tapis')
set(gca,'color',[0,0,0]);

axes(handles.axes3)
specgram(y, 8, 8);
title('Spektrum Sinyal');
set(gca,'color',[0,0,0]);


Thursday, February 22, 2018

Restorasi Sinyal Berderau Berbasis Tapis Chebyshev




Antarmuka GUI MATLAB ini dapat dipakai untuk laboratorium sinyal bagi mahasiswa dan untuk menunjang penelitian bagi para peneliti. Anda bisa memesannya pada form pemesanan di bawah ini.

















KODE UNTUK SALAH SATU EVENT CALLBACK:


  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
function tombolCheby1_Callback(hObject, eventdata, handles)
% hObject    handle to tombolCheby1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

if (handles.fileDimuat==1)
    N = 300;
    OK = 0;

    switch (handles.TapisTerseleksi2)
        case (1)
            % Lowpass:
            Fpass  = str2num(get(handles.editF3,'String'));
            if (length(Fpass)>0)
                if (Fpass<handles.Fs/2-30)
                    handles.Fpass = Fpass;
                    [b,a] = cheby1(6,10,Fpass/(handles.Fs/2),'low');
                    [h,w] = freqz(b,a);
                    %Hd = BangkitkanTapisLowpass(Fpass, Fstop, handles.Fs, N);
                    OK = 1;
                else
                    msgbox('Nila frek tidak ada pada rentang tepat','Nilai Frek Salah','error');
                end
            else
                msgbox('Nilai-Nilai Frek Tidak Ada! Silahkan isi dan coba kembali.','Nilai Frek Tidak Ada','error');
            end
        case (2)      
            % Highpass:
            Fpass = str2num(get(handles.editF3,'String'));            
            if (length(Fpass)>0)
                if (Fpass<handles.Fs/2-30)                
                    handles.Fpass = Fpass;
                    [b,a] = cheby1(6,10,Fpass/(handles.Fs/2),'high');
                    [h,w] = freqz(b,a);
                    OK = 1;
                else
                    msgbox('Nila frek tidak ada pada rentang tepat','Nilai Frek Salah','error');
                end
            else
                msgbox('Nilai-Nilai Frek Tidak Ada! Silahkan isi dan coba kembali.','Nilai Frek Tidak Ada','error');
            end
        case (3)
            % Bandpass:
            Fpass1 = str2num(get(handles.editF3,'String'));            
            Fpass2 = str2num(get(handles.editF4,'String'));
            if ((length(Fpass1)>0) & (length(Fpass2)>0))            
                   handles.Fpass1 = Fpass1;
                   handles.Fpass2 = Fpass2;
                   %Fpass1
                   [b,a] = cheby1(6,10,[Fpass1/(handles.Fs/2) Fpass2/(handles.Fs/2)]);
                   [h,w] = freqz(b,a);
                   OK = 1;
            else
                msgbox('Nilai-Nilai Frek Tidak Ada! Silahkan isi dan coba kembali.','Nilai Frek Tidak Ada','error');
            end
            
        case (4)
            % Bandstop:
            Fpass1 = str2num(get(handles.editF3,'String'));            
            Fpass2 = str2num(get(handles.editF4,'String'));
            if ((length(Fpass1)>0) & (length(Fpass2)>0))            
                   handles.Fpass1 = Fpass1;
                   handles.Fpass2 = Fpass2;
                   %Fpass1
                   [b,a] = cheby1(6,10,[Fpass1/(handles.Fs/2) Fpass2/(handles.Fs/2)],'stop');
                   [h,w] = freqz(b,a);
                   OK = 1;

            else
                msgbox('Nilai-Nilai Frek Tidak Ada! Silahkan isi dan coba kembali.','Nilai Frek Tidak Ada','error');
            end
    end
    
    if (OK==1)
        axes(handles.sumbuTapis);
        %[h,w] = freqz(b,a);
        [H,F] = freqz(b,a,N,handles.Fs);
        plot(F,20*log10(abs(H)))
        title('Tapis Yang Dirancang');

     
        xFinal = filter(b,a,handles.x2);
        handles.xFinal = xFinal;

        axes(handles.sumbuSpektrumAkhir);
        specgram(handles.xFinal, 1024, handles.Fs);
        title('Spektrum Sinyal Penapisan');
        
        % Menghitung MSE dan PSNR
        [M,N]=size(handles.xFinal);
        err = sum((handles.x-handles.xFinal).^2)/(M*M);
        MSE=sqrt(err);
        NILMAKS=65535;
        PSNR = 20*log10(NILMAKS/MSE);

        set(handles.edit6, 'String', num2str(MSE));
        psnr = [num2str(PSNR) ' dB']; 
        set(handles.edit7, 'String', psnr);
        
        %Persentase efisiensi
        EFF = ((handles.mse1 - MSE)/ handles.mse1)* 100;
        eff = [num2str(EFF) ' %']; 
        set(handles.edit22, 'String', eff);
        
        handles.fileFinal=1;
    end
           
    
end
guidata(hObject, handles);


Studi Komparatif Teknik Pembesaran Citra: Bicubic dan B-Spline




Antarmuka GUI MATLAB ini dapat dipakai untuk laboratorium sinyal bagi mahasiswa dan untuk menunjang penelitian bagi para peneliti. Anda bisa memesannya pada form pemesanan di bawah ini.
















KODE UNTUK SALAH SATU EVENT CALLBACK:


% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

g=getimage(handles.axes1);
citra_semula= getimage(handles.axes6);

% B-Spline I 2x
inputI = g;
[r,c] = size(g);
vert = 2; hor = 2;

rn = floor(hor*r);
cn = floor(vert*c);

im_zoom = zeros(rn,cn);
for i = 1:rn;
    x1 = cast(floor(i/hor),'uint32');
    x2 = cast(ceil(i/hor),'uint32');
    if x1 == 0
        x1 = 1;
    end
    x = rem(i/hor,1);
    for j = 1:cn;
        y1 = cast(floor(j/vert),'uint32');
        y2 = cast(ceil(j/vert),'uint32');
        if y1 == 0
            y1 = 1;
        end
        ctl = inputI(x1,y1);
        cbl = inputI(x2,y1);
        ctr = inputI(x1,y2);
        cbr = inputI(x2,y2);
        y = rem(j/vert,1);
        tr = (ctr*y)+(ctl*(1-y));
        br = (cbr*y)+(cbl*(1-y));
        im_zoom(i,j,:) = (br*x)+(tr*(1-x));
    end
end
image_zoom = cast(im_zoom,'uint8');

error = citra_semula - (image_zoom);
MSE2 = sum(sum(error .* error)) / (r * c);

set(handles.edit5, 'String', num2str(MSE2));


% Pembesaran Bicubic 2x
vert = 2; hor = 2;
inputI = g;
[r c] = size(inputI);
rn = floor(hor*r);
cn = floor(vert*c);
%s = zoom;
im_zoom = cast(zeros(rn,cn),'uint8');
im_pad = zeros(r+4,c+4);
im_pad(2:r+1,2:c+1) = inputI;
im_pad = cast(im_pad,'double');
for m = 1:rn
    x1 = ceil(m/hor); x2 = x1+1; x3 = x2+1;
    p = cast(x1,'uint16');
    if(hor>1)
       m1 = ceil(hor*(x1-1));
       m2 = ceil(hor*(x1));
       m3 = ceil(hor*(x2));
       m4 = ceil(hor*(x3));
    else
       m1 = (hor*(x1-1));
       m2 = (hor*(x1));
       m3 = (hor*(x2));
       m4 = (hor*(x3));
    end
    X = [ (m-m2)*(m-m3)*(m-m4)/((m1-m2)*(m1-m3)*(m1-m4)) ...
          (m-m1)*(m-m3)*(m-m4)/((m2-m1)*(m2-m3)*(m2-m4)) ...
          (m-m1)*(m-m2)*(m-m4)/((m3-m1)*(m3-m2)*(m3-m4)) ...
          (m-m1)*(m-m2)*(m-m3)/((m4-m1)*(m4-m2)*(m4-m3))];
    for n = 1:cn
        y1 = ceil(n/vert); y2 = y1+1; y3 = y2+1;
        if (vert>1)
           n1 = ceil(vert*(y1-1));
           n2 = ceil(vert*(y1));
           n3 = ceil(vert*(y2));
           n4 = ceil(vert*(y3));
        else
           n1 = (vert*(y1-1));
           n2 = (vert*(y1));
           n3 = (vert*(y2));
           n4 = (vert*(y3));
        end
        Y = [ (n-n2)*(n-n3)*(n-n4)/((n1-n2)*(n1-n3)*(n1-n4));...
              (n-n1)*(n-n3)*(n-n4)/((n2-n1)*(n2-n3)*(n2-n4));...
              (n-n1)*(n-n2)*(n-n4)/((n3-n1)*(n3-n2)*(n3-n4));...
              (n-n1)*(n-n2)*(n-n3)/((n4-n1)*(n4-n2)*(n4-n3))];
        q = cast(y1,'uint16');
        sample = im_pad(p:p+3,q:q+3,:);
        im_zoom(m,n,1) = X*sample(:,:,1)*Y;
    end
end
im_zoom = cast(im_zoom,'uint8');

error = citra_semula - (im_zoom);
MSE3 = sum(sum(error .* error)) / (r * c);

set(handles.edit9, 'String', num2str(MSE3));

% Pembesaran B-Spline II 2x

zoom = 2;
inputI = g;

[r c] = size(inputI);
img = cast(inputI,'double');
faktor = 1/zoom;
x = 1:c;
xx = 1:faktor:(c+1-faktor);
for i = 1:r
    cs(i,:) = [spline(x,[0 img(i,:) 0],xx),img(i,end)];
end
y = 1:r;
yy = 1:faktor:(r+1-faktor);
for i = 1:(zoom*c)
    us(:,i) = (spline(y,[0 cs(:,i)' 0],yy))';
end
imZoom = cast(us,'uint8');

error = citra_semula - (imZoom);
MSE4 = sum(sum(error .* error)) / (r * c);

set(handles.edit13, 'String', num2str(MSE4));

figure, 
h1=subplot(2,3,1), imshow(citra_semula); title('Citra 512 x 512');
h2=subplot(2,3,2), imshow(g); title('Citra Uji 256 x 256');
h3=subplot(2,3,3), imshow(image_zoom); title('Pembesaran B-Spline I 2x');
h4=subplot(2,3,4), imshow(im_zoom); title('Pembesaran Bicubic 2x');
h5=subplot(2,3,5), imshow(imZoom); title('Pembesaran B-Spline II 2x');

linkaxes([h1,h2,h3,h4,h5])



Wednesday, February 21, 2018

Penapisan Butterworth Untuk Merestorasi Citra Digital


Antarmuka GUI MATLAB ini dapat dipakai untuk laboratorium sinyal bagi mahasiswa dan untuk menunjang penelitian bagi para peneliti. Anda bisa memesannya pada form pemesanan di bawah ini.














KODE UNTUK SALAH SATU EVENT CALLBACK:



function tombolEvaluasiLowPass_Callback(hObject, eventdata, handles)
% hObject    handle to tombolEvaluasiLowPass (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

I=im2double(getimage(handles.axes1));
[baris, kolom, banyakKanal] = size(I);

 if banyakKanal ==1
        Semula=I;
 else
    Semula=rgb2gray(I);
 end

% Frek Cut-Off 50
oimg1=getimage(handles.axes3);
[fftI1, filterKeluaran1, hasil1] = butterworthlpf(oimg1,50,4);

% Frek Cut-Off 100
[fftI2, filterKeluaran2, hasil2] = butterworthlpf(oimg1,100,4);

% Frek Cut-Off 150
[fftI3, filterKeluaran3, hasil3] = butterworthlpf(oimg1,150,4);

% Frek Cut-Off 200
[fftI4, filterKeluaran4, hasil4] = butterworthlpf(oimg1,200,4);

% Frek Cut-Off 250
[fftI5, filterKeluaran5, hasil5] = butterworthlpf(oimg1,250,4);

% Frek Cut-Off 500
[fftI6, filterKeluaran6, hasil6] = butterworthlpf(oimg1,500,4);

% Frek Cut-Off 1000
[fftI7, filterKeluaran7, hasil7] = butterworthlpf(oimg1,1000,4);


% metrik-metrik evaluasi kualitas citra
[m,n]=size(Semula);
hasil1 = imresize(hasil1,[m n]);
hasil2 = imresize(hasil2,[m n]);
hasil3 = imresize(hasil3,[m n]);
hasil4 = imresize(hasil4,[m n]);
hasil5 = imresize(hasil5,[m n]);
hasil6 = imresize(hasil6,[m n]);
hasil7 = imresize(hasil7,[m n]);

oimg1 = imresize(oimg1,[m n]);

size(oimg1)
size(Semula)
size(hasil1)
[RMSE1,PFE1,MAE1,CORR1,SNR1,PSNR1,MI1,QI1,SSIM1] = pereval(double(Semula),double(oimg1),double(oimg1),double(hasil1));
[RMSE2,PFE2,MAE2,CORR2,SNR2,PSNR2,MI2,QI2,SSIM2] = pereval(double(Semula),double(oimg1),double(oimg1),double(hasil2));
[RMSE3,PFE3,MAE3,CORR3,SNR3,PSNR3,MI3,QI3,SSIM3] = pereval(double(Semula),double(oimg1),double(oimg1),double(hasil3));
[RMSE4,PFE4,MAE4,CORR4,SNR4,PSNR4,MI4,QI4,SSIM4] = pereval(double(Semula),double(oimg1),double(oimg1),double(hasil4));
[RMSE5,PFE5,MAE5,CORR5,SNR5,PSNR5,MI5,QI5,SSIM5] = pereval(double(Semula),double(oimg1),double(oimg1),double(hasil5));
[RMSE6,PFE6,MAE6,CORR6,SNR6,PSNR6,MI6,QI6,SSIM6] = pereval(double(Semula),double(oimg1),double(oimg1),double(hasil6));
[RMSE7,PFE7,MAE7,CORR7,SNR7,PSNR7,MI7,QI7,SSIM7] = pereval(double(Semula),double(oimg1),double(oimg1),double(hasil7));

t = handles.uitable4;

d1 = [RMSE1,PFE1,MAE1,CORR1,SNR1,PSNR1,MI1,QI1,SSIM1];
d2 = [RMSE2,PFE2,MAE2,CORR2,SNR2,PSNR2,MI2,QI2,SSIM2];
d3 = [RMSE3,PFE3,MAE3,CORR3,SNR3,PSNR3,MI3,QI3,SSIM3];
d4 = [RMSE4,PFE4,MAE4,CORR4,SNR4,PSNR4,MI4,QI4,SSIM4];
d5 = [RMSE5,PFE5,MAE5,CORR5,SNR5,PSNR5,MI5,QI5,SSIM5];
d6 = [RMSE6,PFE6,MAE6,CORR6,SNR6,PSNR6,MI6,QI6,SSIM6];
d7 = [RMSE7,PFE7,MAE7,CORR7,SNR7,PSNR7,MI7,QI7,SSIM7];

d = [d1;d2; d3; d4; d5; d6; d7];

set(t,'Data',d); 

set(t,'ColumnName',{'RMSE |(Root Mean Square Error)';'PFE |(Persentage Fit Error)';'MAE |(Mean Absolute Error)'; 'CORR| (Correlation)';...
    'SNR |(Signal to Noise Ratio'; 'PSNR |(Peak Signal to Noise Ratio)';'MI | (Mutual Information)'; 'QI| (Quality Index)';...
    'SSIM| (Measure of Structural Similarity)';})

set(t,'RowName',{'50 Hz'; '100 Hz'; '150 Hz'; '200 Hz'; '250 Hz'; '500 Hz'; '1000 Hz'});

%Menampilkan grafik
z=1:9;
axes(handles.axes11);
plot(z',d1, z',d2, z',d3, z',d4, z',d5, z',d6, z',d7); title('Grafik Kinerja TAPIS BUTTERWORTH LOWPASS'); grid on;
legend('50 Hz', '100 Hz', '150 Hz', '200 Hz', '250 Hz', '500 Hz', '1000 Hz')
set(gca,'XTick',1:9)
set(gca,'XTickLabel',{'RMSE','PFE','MAE','CORR','SNR','PSNR','MI','QI','SSIM'});

save d1.mat d1;
save d2.mat d2;
save d3.mat d3;
save d4.mat d4;
save d5.mat d5;
save d6.mat d6;
save d7.mat d7;

flag=1;
save flag.mat flag;