Applying Newton's Method to Sound Level Equation
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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
0 Kommentare
Antworten (1)
John D'Errico
am 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 Kommentar
Siehe auch
Kategorien
Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!