Contents
Start
close all;
clear all;
clc;
Define Important Variables
N = 64;
D = N/2;
a = 8;
w = 0.4;
y = repmat(1:N,N,1);
x = y';
r = sqrt((D-x).^2+(D-y).^2);
sig = 5;
Rectangular Function
re = zeros(N);
re(D-a:D+a-1,D-a:D+a-1) = w*ones(2*a);
mesh(re); title('2D Rectangular Function');
Take Fourier Transform
R = fft2(re);
R = fftshift(R);
figure;mesh(abs(R)); title('Fourier Transform of Rectangular function');
Pyramid Function
p = conv2(re,re,'same');
figure; mesh(p); title('2D Pyramidal Function');
Fourier Transform of pyramid
P = fft2(p);
P = fftshift(P);
figure; mesh(abs(P));title('Fourier Transform of pyramidal function');
Cylinder
c = w*double((r.^2)<a^2);
figure; mesh(c); title('2D Cylindrical Function');
Fourier Transform of Cylinder
C = fft2(c);
C = fftshift(C);
figure; mesh(abs(C));title('Fourier Transform of Cylindrical function');
Cone
co = conv2(c,c,'same');
figure; mesh(co); title('2D Conical Function');
Fourier Transform of Cone
CO = fft2(co);
CO = fftshift(CO);
figure; mesh(abs(CO)); title('Fourier Transform of Conical function');
Airy PSF
psf = (airy(w*r/2).^2)/pi;
figure; mesh(psf); title('2D Point Spread Function');
Fourier Transform of Airy PSF
PSF = fft2(psf);
PSF = fftshift(PSF);
figure; mesh(abs(PSF)); title('Fourier Transform of airy PSF function');
Gaussian
g = (2*pi*sig^2)*exp(-((r.^2))./(2*sig^2));
figure;mesh(g); title('2D Gaussian Function');
Fourier Transform of Gaussian
G = fft2(g);
G = fftshift(G);
figure; mesh(abs(G)); title('Fourier Transform of Gaussian function');
Peak
pk = 1./r;
pk(isinf(pk)) = 1;
figure; mesh(pk); title('2D Peak Function');
Fourier Transform of Peak
Pk = fft2(pk);
Pk = fftshift(Pk);
figure; mesh(abs(Pk)); title('Fourier Transform of peak function');
Exponential Decay
exd = exp(-w*r);
figure; mesh(exd); title('2D Exponential Decay Function');
Fourier Transform of Exponential Dacay
EXD = fft2(exd);
EXD = fftshift(EXD);
figure; mesh(abs(EXD));
title('Fourier Transform of Exponential Dacay function');
No comments:
Post a Comment