File Exchange

image thumbnail

4 Dimensional visualization

version (2.18 MB) by Divahar Jayaraman
This is to visualize the functions of 3 variables: z=f(x,y,t), which becomes 4 dimensional problem


Updated 25 Feb 2010

View License

This is to visualize the functions of 3 independent variables ( v=f(x,y,z) ), which becomes 4 dimensional problem.

It just uses the MATLAB function "slice", in an effective way, leading to customizable 4 dimensional visualization tool.

Function should first be calculated at the required 3-dimensional grid and stored as ?.mat? file in the folder "\Visual_Data\".

The ".mat" files should contain the following variables,


X, Y, Z are the 3 coordinate points and V is the function. All the variables will be 0f l x m x n in size ( three dimensional array with same dimensions)

One example data file is included in the folder.

Many such mat files can be created and kept in the same folder, which can be selected for visualization from the pop-up menu.

A simple m file (2-lines) Create_Volume.m is also included, which may be useful for generating data for simple functions.

Authors Comment:
-- Was written in a hurry for the author?s own requirement and later refined.
-- Will be useful as a quick tool for many scientific investigations for understanding the structure of any 4-dimensional functions.

Comments and Ratings (16)



Nevermind, i got it!
Great work, thanks!!


how can i use the Create_Volume.m to generate the data for plotting? Its just a function...

I have an analytical function of 3 variables (f(x1,x2,x3)) and want to see a plot of it.

Thank you for sharing this nice file!

It's nice.
Sometimes there is not enough information of whole data in such a nice grid, and interpolation of data is also not such an easy job.
For that case, it could be more helpful if it just could show the data points which are introduced but not regularly and in a grid.

was very helpful. a cool visualization tool! thanks a lot divahar :) saved me plenty of work!


Nice Tool, but a bit more documentation would be nice. Also having to put the data in a file in a special folder ist just plain complicated.


Fabulous! Thanks. Coordinate values on the sliders would be a great addition.


Very useful tool! Thank you for sharing!

Minor suggestions:

Making the program more general, in order to plot XYZ with different lengths,

Selectable transparency of planes,

While adjusting x,y,z plane position, the coordinate values should be visible, for reference.

Anyway, this has saved me lots of work ;)


Thank you, this is a very nice tool. Simple yes, no help yes, but it does what it is supposed and needed it to do (and it saved me the time to write it myself). One thing though, 2 of my variables were relatively small 1e-11 and 1e-6 and the sliders didn't work for me. So my quick and dirty suggestions is to make sure that you scale your variable in such case.

buza lala

Kevin Mitchell

This is a really cool utility, but it still needs a little work.

It didn't load the example file at first because it was assumed that my directories were delimited by a "\", where they are in fact delimited by "/". I agree, data should be passed as function arguments if only for portability.

It would also be nice not to be constrained to stay in the directory containing Visualization_4d.m to even close the window.

Srividhya Jeyaraman

The is really a useful tool when one has many parameters to visualize at once. It produces good graphics and allows storage of the picture as jpg file. It served my requirements very well. This tool should improve in a way that is much more customizable according to the user's needs. All the best and congratulations.

F. Lange

Interesting. Nice effort. You can always rework and resubmit as needed.

John D'Errico

This might be useful, but there is essentially no help included.

Furthermore, it seems foolish to me to force the user to use a specific directory, saving .mat files with specific variable names into that directory as an interface. I think recent versions of matlab have a tool that can be used to get around that problem. Its called a "function". You pass your arguments into the function.


Updated to make it work in non WINDOWS Operating Systems also by changing the path specification using "/"

"Error with Slider value" problem was rectified. Thanks to Ms.Srividya for her feedback about it.

Just correction of spelling mistakes in the description

MATLAB Release Compatibility
Created with R14SP1
Compatible with any release
Platform Compatibility
Windows macOS Linux

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.

Learn About Live Editor