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π*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π*f1*t+m*(Cos[t*2π*sf*1.0])]+​​Sin[2π*f1*t+m*(Cos[t*2π*sf*1.2])]+​​Sin[2π*f1*t+m*(Cos[t*2π*sf*1.4])]+​​Sin[2π*f1*t+m*(Cos[t*2π*sf*1.6])],​​{t,0,timerange,nyquist}];​​​​(*filtering*)​​​​rec=data*Table[sig[t,Flo],{t,0,timerange,nyquist}];​​​​filter1=ButterworthFilterModel[{"Bandpass",1,{{2π*if,40}}}];​​filter2=ButterworthFilterModel[{"Bandpass",3,{{2π*if,20}}}];​​filter3=ButterworthFilterModel[{"Bandpass",5,{{2π*if,10}}}];​​​​filtered1=2*RecurrenceFilter[ToDiscreteTimeModel[filter1,nyquist],rec];​​filtered2=2*RecurrenceFilter[ToDiscreteTimeModel[filter1,nyquist],rec];​​filtered3=2*RecurrenceFilter[ToDiscreteTimeModel[filter1,nyquist],rec];​​​​​​(*Definefunction*)​​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"],​​​​(*signalplot*)​​Framed[ListPlot[{filtered1,tone1,tone2,tone3,tone4},(*plotchosenfilteredsignal*)​​PlotLabelStyle["Time domain plot of filtered FM signal2","Subsubsection"],​​JoinedTrue,PlotRange{{5000,15000},Full},ImageSize{Full,Medium},(*Zoom/formatplottomakeFMsignaleasiertosee*)​​PlotLegendsPlaced[LineLegend[Automatic,{"Filtered FM signal","Station 1 tone","Station 2 tone","Station 3 tone","Station 4 tone"},(*Definelegends*)​​LabelStyleBold,LegendLayout"Row"],Bottom]]],​​​​GraphicsRow[{​​Framed[BodePlot[​​{filter1,filter2,filter3},​​{100,300000000},PlotRangeFull,PlotLayout"Magnitude",(*Defineplotdomain*)​​PlotLegendsPlaced[LineLegend[Automatic,{"Filter 1st order","Filter 3rd order","Filter 5th order"},LabelStyleBold],Bottom],(*legendunderneath*)​​FrameLabel{"frequency/Hz","signal Magnitude/dB"}​​]],​​​​(*fouriertransforms*)​​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]​​​​​​​​​​