How to generate a 4 D plot.

1 次查看(过去 30 天)
Rajkumar Verma
Rajkumar Verma 2019-7-19
评论: Rik 2019-7-27
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 个评论
Walter Roberson
Walter Roberson 2019-7-27
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 2019-7-27
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.

请先登录,再进行评论。

回答(2 个)

Walter Roberson
Walter Roberson 2019-7-27
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 个评论
Rik
Rik 2019-7-27
Put the data in an ND array and use a loop to plot pairs in subplot() axes.

请先登录,再进行评论。


John D'Errico
John D'Errico 2019-7-27
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.

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by