[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #63094] FFT2 produces a result that differs fr
From: |
anonymous |
Subject: |
[Octave-bug-tracker] [bug #63094] FFT2 produces a result that differs from MATLAB |
Date: |
Fri, 23 Sep 2022 08:15:40 -0400 (EDT) |
URL:
<https://savannah.gnu.org/bugs/?63094>
Summary: FFT2 produces a result that differs from MATLAB
Project: GNU Octave
Submitter: None
Submitted: Fri 23 Sep 2022 12:15:38 PM UTC
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name: STEPHEN E RANKIN
Originator Email: s.e.rankin@outlook.com
Open/Closed: Open
Release: 6.4.0
Discussion Lock: Any
Operating System: GNU/Linux
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Fri 23 Sep 2022 12:15:38 PM UTC By: Anonymous
The result of trying to differentiate a Gaussian by FFT fails on Octave
running on Ubuntu 22.04, but works on MATLAB with the same code:
size2 = 101;
A = 10;
sigma = 10;
gauss = zeros(size2);
for y = 1:size2
for x = 1:size2
gauss(y,x)=A*exp(-1/(sigma^2)*((y-size2/2)^2+(x-
size2/2)^2)); %gaussiana
end
end
hf = fftshift(fft2(gauss));
[U,V] = meshgrid(-50:50, -50:50);
hf2 = (exp(1i*2*pi*U/101) - 1).*(exp(1i*2*pi*V/101) - 1).*hf;
out_freq = real(ifft2(ifftshift(hf2)));
out_freq = out_freq(1:end-1,1:end-1);
out_spatial = diff(diff(gauss, 1, 1), 1, 2);
figure;
subplot(1,2,1);
imshow(out_spatial, []);
title('Derivative from spatial domain');
subplot(1,2,2);
imshow(out_freq, []);
title('Derivative from frequency domain');
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Fri 23 Sep 2022 12:15:38 PM UTC Name: octave.jpg Size: 19KiB By:
None
<http://savannah.gnu.org/bugs/download.php?file_id=53743>
-------------------------------------------------------
Date: Fri 23 Sep 2022 12:15:38 PM UTC Name: matlab.jpg Size: 15KiB By:
None
<http://savannah.gnu.org/bugs/download.php?file_id=53744>
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?63094>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #63094] FFT2 produces a result that differs from MATLAB,
anonymous <=