3D Surface/Contour of Piecewise Equation
Show older comments
I am trying to design a realistic sound pressure of a point noise. I have a simple version which assumes uniform distribution of sound. What I want is to take into account terrain variations.
Below is the very simple version.
'Sound Pressure'
[X,Y] = meshgrid(-10000:50:10000);
Z = 153.699 - 20.*log10((sqrt(X.^2 + Y.^2))./114.26);
contour3(X,Y,Z,40);
hold on
contourf(X,Y,Z);
hold off;
axis square;
title('Sound Pressure');
xlabel('Distance (m)');
ylabel('Distance (m)');
colorbar;
set(get(colorbar,'ylabel'),'string','dBA','fontsize',10);
Here is what I want to do....
[X,Y] = meshgrid(-10000:50:10000);
if X >= 0;
Z = 153.699 - 20.*log10((sqrt(X.^2 + Y.^2))./0.1524);
else if X < 0;
Z = 163.4 - 20.*log10((sqrt(X.^2 + Y.^2))./0.1524);
end
end
contour3(X,Y,Z,40);
hold on
contourf(X,Y,Z);
hold off;
axis square;
title('Sound Pressure with Terrain');
xlabel('Distance (m)');
ylabel('Distance (m)');
colorbar;
set(get(colorbar,'ylabel'),'string','dB','fontsize',10);
Thanks!
Answers (1)
Walter Roberson
on 6 Jul 2012
[X,Y] = meshgrid(-10000:50:10000);
Z = 153.699 - 20.*log10((sqrt(X.^2 + Y.^2))./0.1524);
Z(X < 0) = Z(X < 0) + (163.4 - 153.99);
Categories
Find more on Audio and Video Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!