Demo 1: Time Domain vs. Frequency Domain of a Sinusoid

In this demo, we consider a f(t) = Αcos(2πft+θ) and draw its time domain plot and frequency domain plot, i.e., magnitude and phase spectrum and demonstrate the effects of frequency, amplitude and phase on those plots.

Manipulate[Grid[{{Plot[{A*Cos[2Pi f t+theta]},{t,-0.1,1},PlotStyle -> Thick, PlotPoints->Round[1000/f],  PlotRange -> 5, GridLines->Automatic,ImageSize -> Medium, AxesLabel->{"time (sec.)","f(t) = ACos[2πft+θ]"},LabelStyle->Directive[Red,Bold], PlotLabel -> "Time Domain Signal (a sinusoid)"],ListPlot[{{f,A/2}, {-f,A/2}},Filling->Axis, PlotRange -> {{-25,25},{0,5}}, FillingStyle->Directive[Opacity[10],Blue,Thick], ImageSize -> Medium,
AxesLabel->{"f (Hz)", "Magnitude (A/2)"},LabelStyle->Directive[Red,Bold], PlotLabel -> "Magnitude Spectrum (Frequency Domain Signal)"]}, {,ListPlot[{{f,theta}, {-f,-theta}},Filling->Axis, PlotRange -> {{-25,25},{-2*Pi,2*Pi}}, FillingStyle->Directive[Opacity[10],Blue,Thick], ImageSize -> Medium, AxesLabel->{"f (Hz)", "Phase (θ)"},LabelStyle->Directive[Red,Bold], PlotLabel -> "Phase Spectrum (Frequency Domain Signal)"]}},ItemSize->automatic],{{f, 10,"Frequency"},0,20 , Appearance -> "Labeled", ImageSize -> Large},{{theta, Pi/4,"Phase"},0,2*Pi,  Appearance -> "Labeled", ImageSize -> Large},{{A, 5, "Amplitude"} ,0,5,  Appearance -> "Labeled", ImageSize -> Large},ContentSize->{800,600}, SaveDefinitions-> True]