Applying Newton's Method to Sound Level Equation

1 visualización (últimos 30 días)
emma
emma el 7 de Abr. de 2021
Editada: emma el 7 de Abr. de 2021
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

Respuestas (1)

John D'Errico
John D'Errico el 7 de Abr. de 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 comentario
emma
emma el 7 de Abr. de 2021
Editada: emma el 7 de Abr. de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by