Manipulate[
(*Nasser M. Abbasi, June 20, 2014*)
(*the signal is cosine, and the SNR is given as ratio of variances*)
Module[{nPoints,x0,varx0,n,x,del},
nPoints=128;
del=4 Pi/(nPoints-1);
x0=Cos[Range[0,4*Pi,del]];
varx0=Variance[x0];
SeedRandom[0];
n=RandomVariate[NormalDistribution[0,1],nPoints];
x=x0+Sqrt[varx0/snr]*n;
Show[ListLinePlot[x0,PlotStyle->Blue],ListLinePlot[x,PlotStyle->Red],PlotRange->{{0,Round[xmax/del]},{-ymax,ymax}},ImagePadding->{{40,15},{40,40}},Frame->True,ImageSize->400,FrameLabel->{{"y(t)",None},{"time","Adding noise to signal"}},Axes->None]
],
Grid[{
{"SNR",
Manipulator[Dynamic[snr,{snr=#}&],{1,999,1},ImageSize->Tiny],
Dynamic@Row[{NumberForm[snr,3]," (",NumberForm[10. Log[10,snr],4]," db)"}]
},
{"x max",
Manipulator[Dynamic[xmax,{xmax=#}&],{.1,4.*Pi,.1},ImageSize->Tiny],
Dynamic[xmax]
},
{"y max",
Manipulator[Dynamic[ymax,{ymax=#}&],{.1,1.4,.1},ImageSize->Tiny],
Dynamic[ymax]
}
},Alignment->Left
],
{{snr,50},None},
{{xmax,4.*Pi},None},
{{ymax,1.4},None}
]