"Attempt to execute SCRIPT fft2 as a function" Don't know how to solve this mistake. fft2 is a function of matlab. Thanks!

3 views (last 30 days)
clc;clear;
datos = imread('/users/Desktop/arroz.png');
U = im2double(datos);
[N,M] = size(datos);
P = 2*N;
Q = 2*M;
K1 = [0.0509 0.1238 0.0509;0.1238 0.3012 0.1238;0.0509 0.1238 0.0509];
K2 = [0.4444 0.1111 0.4444;0.1111 -2.2222 0.1111; 0.4444 0.1111 0.4444];
h1 = conv2(U,K1,'same');
h2 = conv2(U,K2,'same');
figure;
subplot(1,2,1);imshow(h1,[]);title('Convolución con kernel K1');
subplot(1,2,2);imshow(h2,[]);title('Convolución con kernel K2');
ZP1 = zeros(P,Q);
ZP2 = zeros(P,Q);
ZP1(1:N,1:M) = h1;
ZP2(1:N,1:M) = h2;
DFT1 = fft2(ZP1);
DFT2 = fft2(ZP2);
figure;
subplot(1,2,1);imshow(log(abs(DFT1))+1,[]);title('DFT de imagen convolucionada con K1');
subplot(1,2,2);imshow(log(abs(DFT2))+1,[]);title('DFT de imagen convolucionada con K2');

Accepted Answer

Star Strider
Star Strider on 21 Nov 2016
You have a file in your user directory called ‘fft2’. Find it with:
which fft2 -all
then find the file in your user directory, and re-name it to something that does not conflict with any built-in MATLAB function name.

More Answers (0)

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!