Contour plot with multiple variables
11 views (last 30 days)
Show older comments
Hello everyone,
I am working on a mathematical modeling problem and need your help with contourf plot of multiple variables. As for now, I can plot the change of the volume
with respect to the the shear stress
(x axis) and
(y axis). In a similar fashion, I can plot
with respect to coefficient
(x axis) λ(y axis).

Now these parameters are called from an external function using (where
(betae) and λ(lambda) are set constant):
for taue= 0:0.05:0.5
r=1;
for taus= 0:0.05:0.5
A2(l,r)=erosion(iterx,itertime,time,lambda,Pe,taue,taus,betae,betas,delta,BCtop,BCbottom,m);
r=r+1;
end
l=l+1;
end
% Then calling contourf plot
[C,h]=contourf(X,Y,A2);
Similarly I can plot for
(x axis) and λ(y axis) simply by changing the iteration parameters, and setting (
(taue) and
(taus)) to be constant.

Now I would like to have a contour plot with all 4 variable (if possible), since there is a correlation for
in all four of the parameters.
(lower x axis) and
(left y axis) and
(top x axis) λ(right y axis).
If you need additional information to resolve an approach, please let me know. Thanks!
0 Comments
Answers (1)
Walter Roberson
on 28 Dec 2020
You have four independent inputs, and one output, for a total of five variables.
You cannot use slice() or isosurface() as those are restricted to three independent inputs and one output, for a total of four variables.
Therefore, you will need to use scatter3(), with the x, y, z coordinates encoding three of the inputs, the point size encoding the fourth input, and the color encoding the output. You may need to set AlphaData in order to be able to see "inside" the 4d shells.
You will probably not be able to understand the result.
You will not want to display all the possible points: only the ones corresponding to the isosurfaces you have chosen. Unfortunately, figuring out which those are might take a bit of work. You might have to resort to doing a series of 3d contours and stitching them together. You can extract the contour matrix from contour3() https://www.mathworks.com/help/matlab/ref/contour3.html#mw_8699e0c8-d627-48fd-9de6-b1a898362667 and there are some File Exchange contributions that make it easier to interpret those contour matrices.
0 Comments
See Also
Categories
Find more on Contour Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!