Clear Filters
Clear Filters

How to generate a 4 D plot.

1 view (last 30 days)
Rajkumar Verma
Rajkumar Verma on 19 Jul 2019
Commented: Rik on 27 Jul 2019
Dear Friends,
We have four variables: ,,, with conditions ,. We want to plot this function
with assumption that .
How can we generate the plot for F?
  2 Comments
Walter Roberson
Walter Roberson on 27 Jul 2019
You have 4 independent values and 1 dependent value, so your plot would have to be 5 dimensional. Did you have some ideas on how you wanted to encode the 5 different dimensions ?
Rajkumar Verma
Rajkumar Verma on 27 Jul 2019
In this problem,I want the generate this graph for all pairs [(x,y), ()] which satisfy the conditions and . Here are connected and are connected.

Sign in to comment.

Answers (2)

Walter Roberson
Walter Roberson on 27 Jul 2019
vals = 0 : 0.01 : 1;
[p1, p2] = ndgrid(vals);
mask = p1 + p2 <= 1;
p1 = p1(mask);
p2 = p2(mask);
[idx1, idx2] = ndgrid(1:length(p1));
V = @(M) M(:);
x = V(p1(idx1));
y = V(p2(idx1));
u = V(p1(idx2));
v = V(p2(idx2));
Now x, y, u, v are each column vectors, and for any given index, x(K), y(K), u(K), v(K) is such that x(K)+y(K)<=1 and u(K)+v(K)<=1 . This gives you 26532801 (over 26 million) points.
You can now evaluate F in vectorized form. You can then do corrections for the cases where x and u are both 0 or y and v are both 0 or 1-x-y is 0 together with 2 - x - u - u - v being 0.
This will leave you with 26532801 x, y, u, v, F coordinate tuples.
With the data all calculated, you now have to decide what a 5 dimension plot should look like. Did you have some ideas on how you want to represent 5 dimensional data on a 2 dimensional display ?
  4 Comments
Rik
Rik on 27 Jul 2019
Put the data in an ND array and use a loop to plot pairs in subplot() axes.

Sign in to comment.


John D'Errico
John D'Errico on 27 Jul 2019
You want to plot some function of 4 variables. So essentially, you have a 5-dimensional plot you want to see. Not gonna happen. Your monitor is TWO dimensional. We plot 3-d plots as needed, because your brain understands how to visualize a 3-d thing from a 2-d scene. You rotate it around, etc, then gaining an understanding of the object.
But you have 5 dimensions of interest. Not 2 or 3. Not even 4 (where there is one trick you can do with an iso-surface, sort of a contour plot in 3-d.) You can also play with Chernoff faces, but I have never personally found them to be of much value.
So unless you have bought one of those new holodeck monitors, available from Starfleet Command for a princely sum of federation credits (surely you can guess what it costs to ship stuff from the other side of the galaxy) you cannot visualize 5-dimensional stuff on a 2-d monitor.
I'm sorry, but we all live in sphereland. (Read the book! At least, start with Flatland, truly a fun book to read.) 5-dimensions is out of view for us common 3-d people, who can see only 3 dimensions.

Categories

Find more on Line Plots in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!