# 3D Surface/Contour of Piecewise Equation

Asked by Caleb on 5 Jul 2012
Latest activity Answered by Walter Roberson on 6 Jul 2012

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!

## Products

No products are associated with this question.

```[X,Y] = meshgrid(-10000:50:10000);