MATLAB: Reduction of code lines

codeimage

Alright, so I've written this particular thing to blur an image and I've been wondering if I could reduce the number of lines or perhaps cut down the redundancies within this code especially the last line which copies one matrix to an other. Any over the top ideas would also be appreciated!
a=512;
b = a^2/16;
c=(sqrt(b)-1)/2;
ft11 = fftshift(fft2(myImage));
width = size(myImage,1);
F1 = zeros(width);
d = width/2;
e = (d-c:d+c)+1;
ft11(e,e)=F1(e,e);

Best Answer

  • a = 512;
    B = a/4;
    c = (B-1)/2;
    ft11 = fftshift(fft2(myImage));
    width = size(myImage,1);
    d = width/2;
    e = (d-c:d+c)+1;
    ft11(e,e) = 0;