# Question:Fourier Transform: How to plot amplitude and frequency?

## Question:Fourier Transform: How to plot amplitude and frequency?

Maple

Hello,

I have tried to get a simple matlab example of a fourier transform code to work in Maple. This is just to understand a simple fourier transform and eventually try some more difficult 2D transforms.

```restart:
with(LinearAlgebra):
with(RandomTools):
with(orthopoly):
with(plots):
with(ArrayTools):
with(DiscreteTransforms):
Digits:=15:

# 1D Fourier Transform

Fs := 1000;                       # Sampling frequency
T := 1/Fs;                        # Sampling period
L := 1500;                        # Length of signal
t := Vector(L, i -> i-1)*T:       # Time vector

f := Fs*Vector(floor(L/2)+1, i-> i-1)/L:   # Frequency

S:= Vector(L, i -> 0.7*sin(2.0*Pi*50*t[i]) + sin(2.0*Pi*120*t[i])):    # Signal

Z1 := FourierTransform(Vector(L, j->S[j])):              # DFT
Z2 := Vector(L, i-> sqrt(Re(Z1[i])**2 + Im(Z1[i])**2)):  # Amplitude

FP1 := pointplot({seq([f[n],Z2[n]],n=1..floor(L/2)+1)}, labels=["Frequency","Amplitude"], connect=true, color=green):

display(FP1, axes=boxed);
```

The right answer should be a plot with frequencies at 50Hz and 120Hz, with amplitudes at 0.7 and 1.0, respectively. However my amplitude axes is off somehow and I don't understand why.

﻿