Question: dB magnitude spectrum.

I  Presented problems for the plot "DB magnitude spectrum."
The structure of vector data spec has the following configuration,Float (-infinity), inside.

N := 64;
T := 1;

f := .25;
A := 1;
phi := 0;
n := Vector(N, -> i-1, datatype = complex[8]);

x := cos~(2*Pi*n*f*T);

X := DiscreteTransforms[FourierTransform](x, normalization = none);

magX := abs(X)

fn := Vector(N, i-> evalf((i-1)/N) );

DynamicSystems:-DiscretePlot(fn, magX, style = stem, color = blue, labels = ["Normalized Frequency (cycles per sample)", "Magnitude (Linear)"], labeldirections = ["horizontal", "vertical"]);

spec := 20*log10~(magX)

plot(<fn| spec>, view = [0 .. 1, -350 .. 50])

The expected graph is as follows:


How to do it?

Gracias

Please Wait...