Inaccuracy in obtaining the Absorption coefficient

Hello all,
I have an equation for attenuation of sound underwater. The expected plot of attenuation versus frequency is as shown below
But the obtained result is as below
clc
f= 0:1:1000;
xa = f.^2;
fa = (((0.11*(xa))/(1+(xa))) + ((44*(xa))/(4100+(xa))) + (2.75*(xa)/10000) + 0.003);
plot (f,fa);
The matlab code is as shown above.
For f=0, the plotted result should have been zero ( or 0.03 which is close to zero) as in first image. But the plotted value is somewhat near 2000.
Why am I not getting proper result?

 Accepted Answer

In your expression for 'fa' you need to use dots in the division operations on vectors:
fa = (((0.11*(xa))./(1+(xa))) + ((44*(xa))./(4100+(xa))) + (2.75*(xa)/10000) + 0.003);
Otherwise it will give you fallacious results.

2 Comments

The plot results you show are too large by a factor of about fifty from what your formula would produce according to the code you describe. You must have taken a step in the code which you don't show.
However, if you make the "dots" correction, then the plot result from your expression would agree quite well with the "expected" plot.
Thank you Roger. It solved my problem.

Sign in to comment.

More Answers (1)

What is the point of calculating ga, x, y, and so on, if you are not going to use them? You plot f against fa, and ignore everything else you calculated.
Where is your conversion to decibels?
Why is your x axis showing up to 1000 when you are plotting f on the x axis and f is at most 100?

1 Comment

Actually, the code put up here was a part of big program. I have edited the post. Why am I not getting the value 0 or 0.003 (which is also close to zero) for f = 0?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!