MATLAB Answers

Applying Newton's Method to Sound Level Equation

20 views (last 30 days)
emma
emma on 7 Apr 2021
Edited: emma on 7 Apr 2021 at 13:00
I am trying to apply Newton's root-finding method to the following equation that measures sound level (in decibels) at a distance r meters from a source: L= L_0 - 20log10(r) - beta*r
Since we can't solve this directly, how can I find the derivative of the equation with the new function below? I'd like to print the root too. Am I able to use a function on MatLab to do both of these?
syms r
f(r) = L0 - 20 .* log10(r) - beta .* r - L;
% Given
L0 = 80;
beta = 0.00115;
L = 20;
tol = 0.000001;
This is Newton's Method from one of my previous assignments :
% Function file
function [c] = newtonsMethod(f,der,x0,tol)
% Inputs: f = function; der = derivative of function; x0 = initial guess; tol = error tolerance
err = 3*tol;
c=x0;
while err>tol
% Newton's method
c=c-f(c)/der(c);
err=abs(f(c));
end
end

Answers (1)

John D'Errico
John D'Errico on 7 Apr 2021
Since we cannot solve it directly.... Are you absolutely positive of that?
L0 = 80;
beta = 32.2;
L = 20;
syms r
solve(L0 - 20 .* log10(r) - beta .* r - L == 0,r)
ans =
(100*lambertw(0, 1610*log(10)))/(161*log(10))
I suppose, if you say no solution exists, I could just believe you. But then why is MATLAB wrong, in claiming a solution exists? ;-) Admittedly, the solution uses the lambertw function.
help lambertw
My guess is, you are still supposed to use Newton's method. Do you mean you cannot differentiate?
diff(L0 - 20 .* log10(r) - beta .* r - L,r)
ans =
- 20/(r*log(10)) - 161/5
I'm a bit confused where the problem lies.
  1 Comment
emma
emma on 7 Apr 2021
Thank you for the function info! I meant that L= L_0 - 20log10(r) - beta*r cannot be solved directly, which is why we have to solve F(unknown) = RHS - LHS. Hence, solving for L0 - 20 .* log10(r) - beta .* r - L.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by