# 3D visualization in MATLAB

I have a function of 3 variables like $$V= f(r_1, p, r_2)$$, I want to plot these 4 data in one graph to be able to capture the behavior of V with respect to all three variables.

I searched a little bit and read about Sliceomatic but not sure how does it work and if it delivers my requirements. I would appreciate if someone could suggest a way for it.

As an example lets say I have:

r1 = [1 2 3 4 5 6];
p = [2 4 5 8 9 7];
r2 = [10 45 1 0 7 9];
v = 5.*r1.^2 + 2.*p.^2 + r2.^2;

• Plotting functions of 3 variables is usually referred to as "3D visualization", so you may have been looking in the wrong direction. – Jakub Klinkovský May 26 '17 at 18:58

As mentioned by @jlk, what you want is a 3D visualization, or visualization of Three-dimensional data.

Most approaches for 3D visualization fall into one of the following categories (from reference 1):

• Slicing techniques: Using a cut plane probe the data to extract a two-dimensional slice of the data, and then use a two-dimensional spatial data visualization methods.

• Isosurface techniques: Given a user-specified value, generate a (or several) surface description and visualize it using surface visualization techiniques.

• Direct volume rendering: Where an opacity function is assigned to values in the data, and you can see through it when rendered.

Sliceomatic uses the slicing option, and it seems useful for exploratory visualization. In the case of MATLAB you can check their documentation for options. Some of them are:

And it seems that Volume Render from the File Exchange can be used for the third option.

If you need to go serious with these visualizations maybe you should go with a dedicated software for it. You can use ParaView, or MayaVi with Python, among others.

## References

1. Matthew O. Ward, Georges Grinstein, Daniel Keim (2015). Interactive Data Visualization: Foundayions, Techniques, and Applications. CRC Press.