R

#### Riderdie

##### Guest

This is the plot I am getting currently. Note the flat line near the bottom of each subplot:

Here is the code for the graph generation. The

`parsedData`

variable is a 2D array of the given data. parsedData[0] gives the time step values, while all following indices are arrays of y values.Code:

Code:

```
def GenerateFFT(parsedData,T):
colors = ["red","green","blue","purple","orange","cyan","pink","black"]
parsedDataY=parsedData[1:]
print(parsedDataY[len(parsedDataY)-1])
fig, ax = plt.subplots(len(parsedDataY),sharex=True,sharey=True)
#FourierValues = [[] for _ in range(4)]
for i in range(len(parsedDataY)):
signal = np.array(parsedDataY[i],dtype=float)
N=signal.size
print(f"Signal Size at i={i}: {N}")
x=np.arange(30.0,49.035,.005)
fourier = np.fft.fft(signal)
fourierFreq = np.fft.fftfreq(n=signal.size,d=1.0/T)
#FourierValues[i].append(fourier)
print(np.sqrt(np.sqrt(fourier.real**2+fourier.imag**2)).tolist)
ax[i].plot(fourierFreq,np.sqrt(fourier.real**2+fourier.imag**2),color=colors[i],linewidth=.75)
ax[i].set_yscale("log")
ax[i].set_xbound(lower=-10,upper=10)
plt.setp(ax, xlim=(0,10),ylim=ax[0].get_ylim())
fig.suptitle("Fourier Transforms of Monochromatic Wavetrains with Amplitude Modulation",fontweight="bold")
fig.supxlabel("Frequency (Hz)",fontweight="bold")
fig.supylabel("Amplitude (cm) on Logarithmic Scale",fontweight="bold")
plt.show()
```

<p>This is the plot I am getting currently. Note the flat line near the bottom of each subplot:</p>

<p><img src="https://i.sstatic.net/KPqKraqG.png" alt="1" /></p>

<p>Here is the code for the graph generation. The <code>parsedData</code> variable is a 2D array of the given data. parsedData[0] gives the time step values, while all following indices are arrays of y values.</p>

<p>Code:</p>

<pre><code>def GenerateFFT(parsedData,T):

colors = ["red","green","blue","purple","orange","cyan","pink","black"]

parsedDataY=parsedData[1:]

print(parsedDataY[len(parsedDataY)-1])

fig, ax = plt.subplots(len(parsedDataY),sharex=True,sharey=True)

#FourierValues = [[] for _ in range(4)]

for i in range(len(parsedDataY)):

signal = np.array(parsedDataY

*,dtype=float)*

N=signal.size

print(f"Signal Size at i={i}: {N}")

x=np.arange(30.0,49.035,.005)

fourier = np.fft.fft(signal)

fourierFreq = np.fft.fftfreq(n=signal.size,d=1.0/T)

#FourierValues

N=signal.size

print(f"Signal Size at i={i}: {N}")

x=np.arange(30.0,49.035,.005)

fourier = np.fft.fft(signal)

fourierFreq = np.fft.fftfreq(n=signal.size,d=1.0/T)

#FourierValues

*.append(fourier)*

print(np.sqrt(np.sqrt(fourier.real**2+fourier.imag**2)).tolist)

axprint(np.sqrt(np.sqrt(fourier.real**2+fourier.imag**2)).tolist)

ax

*.plot(fourierFreq,np.sqrt(fourier.real**2+fourier.imag**2),color=colors**,linewidth=.75)*

axax

*.set_yscale("log")*

axax

*.set_xbound(lower=-10,upper=10)*

plt.setp(ax, xlim=(0,10),ylim=ax[0].get_ylim())

fig.suptitle("Fourier Transforms of Monochromatic Wavetrains with Amplitude Modulation",fontweight="bold")

fig.supxlabel("Frequency (Hz)",fontweight="bold")

fig.supylabel("Amplitude (cm) on Logarithmic Scale",fontweight="bold")

plt.show()

</code></pre>plt.setp(ax, xlim=(0,10),ylim=ax[0].get_ylim())

fig.suptitle("Fourier Transforms of Monochromatic Wavetrains with Amplitude Modulation",fontweight="bold")

fig.supxlabel("Frequency (Hz)",fontweight="bold")

fig.supylabel("Amplitude (cm) on Logarithmic Scale",fontweight="bold")

plt.show()

</code></pre>