0

要求された完全なテスト コード:

import numpy as np
import matplotlib.pyplot as plt

# Numtopad determines number of padding points
numtopad  = 512

# Define axis
x = np.arange(numtopad)
y = x[:,np.newaxis]

# Offsets which are zero
x0 = 256*0
y0 = 256*0

# Exponentially decaying function in 2D
f = np.exp( -((y-y0) + (x-x0))/(10))

# Fourier transform above function and move zero frqeuencies to center of graph
f2 = np.fft.fft(f,axis=0)
f2 = np.fft.fft(f2,axis=1)
f2 = np.fft.fftshift(f2,axes=0)
f2 = np.fft.fftshift(f2,axes=1)

Delta_t = x[1]-x[0]

# Define a frequency
freq_t = np.fft.fftfreq(numtopad,d = Delta_t)
freq_offset = 200

E1 = freq_t + freq_offset
E2 = freq_t + freq_offset

# plt.contourf(abs(f2))
plt.contourf(E1,E2,abs(f2))
4

1 に答える 1