# List Plot Error [closed]

I've produced this simulation of a superhetrodyne radio receiver. I'm pretty sure it's solid for the most part but I'm getting a list plot error.

ListPlot::lpn: {{{1.,0.},{2.,0.00104953},{3.,0.00417391},{4.,0.00897666},{5.,0.0144962},{6.,0.019545},{7.,0.0231284},{8.,0.0247955},{9.,0.0247967},{10.,0.0239932},<<31>>,{42.,0.0875546},{43.,0.0860275},{44.,0.0862261},{45.,0.0881567},{46.,0.091152},{47.,0.0941063},{48.,0.0958663},{49.,0.0956389},{50.,0.0932715},<<385951>>},<<3>>,{}} is not a list of numbers or pairs of numbers.

I'm having a total nightmare trying to make sense where my mistake is. Any help would be appreciated.

Code below. Thank you.

f1 = 87500000;
f2 = 92000000;
f3 = 965000000;
f4 = 101000000;

sf = 10000;
if = 10700000;
m = 1;

stationselect = f1;

Flo = stationselect + if;

nyquist = 1/(2*Max[{f1, f2, f3, f4}]);
nyquist

timerange = 2/sf;

Clear[sig];  sig [t_, f_] := Sin[2 \[Pi]*f*t];

tone1 = Table[sig[t, {sf*1.0}], {t, 0, timerange, nyquist}];
tone2 = Table[sig[t, {sf*1.2}], {t, 0, timerange, nyquist}];
tone3 = Table[sig[t, {sf*1.4}], {t, 0, timerange, nyquist}];
tone4 = Table[sig[t, {sf*1.6}], {t, 0, timerange, nyquist}];

(*transmitting*)

data = Table[
Sin[2 \[Pi]*f1*t + m*(Cos[t*2 \[Pi]*sf*1.0])] +
Sin[2 \[Pi]*f1*t + m*(Cos[t*2 \[Pi]*sf*1.2])] +
Sin[2 \[Pi]*f1*t + m*(Cos[t*2 \[Pi]*sf*1.4])] +
Sin[2 \[Pi]*f1*t + m*(Cos[t*2 \[Pi]*sf*1.6])],
{t, 0, timerange, nyquist}];

(* filtering*)

rec = data*Table[sig[t, Flo], {t, 0, timerange, nyquist}];

filter1 = ButterworthFilterModel [{"Bandpass", 1, {{2 \[Pi]*if, 40}}}];
filter2 = ButterworthFilterModel [{"Bandpass", 3, {{2 \[Pi]*if, 20}}}];
filter3 = ButterworthFilterModel [{"Bandpass", 5, {{2 \[Pi]*if, 10}}}];

filtered1 =
2* RecurrenceFilter[ToDiscreteTimeModel[filter1, nyquist], rec];
filtered2 =
2* RecurrenceFilter[ToDiscreteTimeModel[filter1, nyquist], rec];
filtered3 =
2* RecurrenceFilter[ToDiscreteTimeModel[filter1, nyquist], rec];

(*Define function*)
Clear[fourierPlot];

fourierPlot[s_] :=
Transpose[{Range[0, 0.5/nyquist,
0.5/(nyquist * (Length[Abs[Fourier[s]]] - 1))], Abs[Fourier[s]]}];

(*display*)
Framed[
Column[{
Style["Filtered signal", "section"],

(*signal plot*)
Framed[
ListPlot[{filtered1, tone1, tone2, tone3,
tone4}, (*plot chosen filtered signal*)
PlotLabel ->
Style["Time domain plot of filtered FM signal2",
"Subsubsection"],
Joined -> True, PlotRange -> {{5000, 15000}, Full},
ImageSize -> {Full, Medium},(*Zoom/
format plot to make FM signal easier to see*)
PlotLegends ->
Placed[LineLegend[
Automatic, {"Filtered FM signal", "Station 1 tone",
"Station 2 tone", "Station 3 tone",
"Station 4 tone"}, (*Define legends*)
LabelStyle -> Bold, LegendLayout -> "Row"], Bottom]]],

GraphicsRow[{
Framed[BodePlot[
{filter1, filter2, filter3},
{100, 300000000}, PlotRange -> Full,
PlotLayout -> "Magnitude",(*Define plot domain*)
PlotLegends ->
Placed[LineLegend[
Automatic, {"Filter 1st order", "Filter 3rd order",
"Filter 5th order"}, LabelStyle -> Bold],
Bottom], (*legend underneath*)
FrameLabel -> {"frequency/Hz", "signal Magnitude/dB"}
]],

(*fourier transforms*)
Manipulate[
ListPlot[
Evaluate[
FunctionDisplay /. {1 -> fourierPlot[rec],
2 -> fourierPlot[filtered1], 3 -> fourierPlot[filtered2],
4 -> fourierPlot[filtered3]}],
Joined -> True, ImageSize -> Large, PlotRange -> All,
PlotLabel -> Style["FFT or Signals", "Subsubsection"],
Ticks -> {Join[
Table[{i*10^7, ScientificForm[i*10^7]}, {i, 0., 12., 1.}]],
Automatic},
PlotStyle -> {

Directive[ColorData[97, "ColorList"][[5]], Opacity[0.8],
Thin],
ColorData[97, "ColorList"][[1]],
ColorData[97, "ColorList"][[2]],
ColorData[97, "ColorList"][[3]]
}[[FunctionDisplay]],

PlotLegends ->
Placed[LineLegend[
Automatic, {"mixed signal (rec)", "1st order filter",
"3rd order filter", "5th order filter"}[[
FunctionDisplay]],
LabelStyle -> Bold, LegendLayout -> "Row"], Bottom],
FrameLabel -> {"Frequency/Hz", "Amplitude/V"}
],
{{FunctionDisplay, {1, 2, 3, 4}}, {1 -> "Mixed Signal",
2 -> "1st Order Filter", 3 -> "3rd Order Filter",
4 -> "5th Order Filter"}, CheckboxBar},
ControlPlacement -> Bottom, FrameMargins -> None
]
}, ImageSize -> Full]
}, Alignment -> Center],
FrameMargins -> Automatic]

• The "tones" are not flattened: ListPlot[Map[Flatten, {filtered1, tone1, tone2, tone3, tone4}] – demm Jan 9 at 15:37
• Crossposted here. – Rohit Namjoshi Jan 9 at 16:57

tone1 = Table[sig[t, sf*1.0], {t, 0, timerange, nyquist}];