Mathematical Principles for Scientific Computing and Visualization  
http://www.farinhansford.com/books/scv
by Gerald Farin and Dianne Hansford


This notebook demonstrates that decibels (log plots) are more useful than power for illustrating a range of noises due to their wide variation in value.

Figures 12.15 and 12.16 were created with this notebook.

See Chapter 12: Visualizing Empirical Data for details.

Updated May 2008

(* Set output folder to one that this file lives in *)
SetDirectory[ToFileName[Extract["FileName"/.NotebookInformation[EvaluationNotebook[]],{1},FrontEnd`FileName]]];

(* Create noise power data *)
noisepower={{1,0.00002`},{2,0.00006`},{3,0.0002`},{4,0.02`},{5,0.2`},{6,0.6`},{7,2},{8,6}}

(* Create noise data as decibles *)
noisedb={{1,0},{2,10},{3,20},{4,60},{5,80},{6,90},{7,100},{8,110}}


(* Create plot of noise data in power form *)

Print["Noise plotted as power (Pa)"]
Print["The first four values are indistinguishable"]

pic1=ListPlot[noisepower,PlotStyle->{GrayLevel[0.0],PointSize[0.03`]},AxesLabel->{"Sources", "Pa"}, PlotRange->All,
Ticks->{{0,1,2,3,4,5,6,7,8},{0,1,2,3,4,5,6}},GridLines->{Automatic,Automatic}, BaseStyle->{"FontFamily"->"Helvetica","FontSize"->11},  AxesStyle->Directive[GrayLevel[0.0],Thickness[0.005]],TicksStyle->Directive[GrayLevel[0.0],Thickness[0.005]], GridLinesStyle->Directive[GrayLevel[0.0],Thickness[0.0025]],ColorOutput->CMYKColor]

(* Create plot in a Log plot of noise data in power form *)
(* Notice, this is the same as the plot in db form below. *)

Print["Plot of the power values with a log plot"]

pic2=ListLogPlot[noisepower,PlotStyle->{GrayLevel[0.0], PointSize[0.03`]},AxesLabel->{"Sources", "Pa"},Ticks->{{0,1,2,3,4,5,6,7,8},{0,0.0001, 0.001, 0.01, 0.1, 1}}, 
GridLines->{Automatic,Automatic},BaseStyle->{"FontFamily"->"Helvetica","FontSize"->11},
AxesStyle->Directive[GrayLevel[0.0],Thickness[0.005]],TicksStyle->Directive[GrayLevel[0.0],Thickness[0.005]], GridLinesStyle->Directive[GrayLevel[0.0],Thickness[0.0025]],ColorOutput->CMYKColor]

(* Create plot  of noise data in db form *)

Print["Plot of the power values converted to decibles"]
Print["This is identical to the previous log plot!"]

pic3=ListPlot[noisedb,PlotStyle->{GrayLevel[0.0],PointSize[0.03`]},AxesLabel->{"Sources", "dB"},GridLines->{Automatic,Automatic},BaseStyle->{"FontFamily"->"Helvetica","FontSize"->11},
AxesStyle->Directive[GrayLevel[0.0],Thickness[0.005]],TicksStyle->Directive[GrayLevel[0.0],Thickness[0.005]], GridLinesStyle->Directive[GrayLevel[0.0],Thickness[0.0025]],ColorOutput->CMYKColor]

(* Output to postscript file *)

Export["noise_power.eps",pic1];
Export["noise_log.eps",pic2];
Export["noise_db.eps",pic3];