https://rpubs.com/ScottWeiner19/1015945

Purpose

The objective of this document is to illustrate the exponential relationship between distance and sound propogation from a single source. This relationship is defined by the inverse sqaure law. Distance doubles for every 6 dB.

SoundData <- read.csv(file ='sound_data.csv')

##Distance sound level measured 
DistFeet <- (SoundData$Distance)
DistFeet
##  [1]    1.25    2.50    5.00   10.00   20.00   40.00   80.00  160.00  320.00
## [10]  640.00 1280.00 2560.00 5120.00
##Sound pressure level in units of dB's 
dB <- (SoundData$SoundPressure)
dB
##  [1] 134 128 122 116 110 104  98  92  86  78  74  68  62
x <- lm(DistFeet ~ dB)
summary(x)
## 
## Call:
## lm(formula = DistFeet ~ dB)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1066.8  -700.5  -204.7   390.1  2672.2 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)   
## (Intercept)  5319.39    1323.86   4.018  0.00202 **
## dB            -46.32      13.18  -3.513  0.00486 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1073 on 11 degrees of freedom
## Multiple R-squared:  0.5287, Adjusted R-squared:  0.4859 
## F-statistic: 12.34 on 1 and 11 DF,  p-value: 0.004857
exponential.model <-lm(log(DistFeet) ~ dB)
summary(exponential.model)
## 
## Call:
## lm(formula = log(DistFeet) ~ dB)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.199545  0.001062  0.013515  0.025969  0.042574 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 15.6179617  0.0798556   195.6   <2e-16 ***
## dB          -0.1148327  0.0007952  -144.4   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.06474 on 11 degrees of freedom
## Multiple R-squared:  0.9995, Adjusted R-squared:  0.9994 
## F-statistic: 2.085e+04 on 1 and 11 DF,  p-value: < 2.2e-16
Dist.exponential2 <- exp(predict(exponential.model,list(dB)))

plot(DistFeet ~ dB, pch=16, main="Sound Propogation at Increasing Distances",
     ylab="Distance (Feet)",
     xlab= "Sound Pressure Level in dB"
)
#line of best fit using predicted values from regression
lines(dB,Dist.exponential2,lwd=0.5, col = "red")