Plotting a 4D graph with the fourth dimension using color (a 3D graph with the fourth dimension represented using colors)
古いコメントを表示
I would like to know how to plot R0 (basic reproduction number of a disease) against three given parameters on a 3D plot where the x-, y-, and z- axes represent the three parameters and a color scheme represents R0. So, the graph should essentially be a 3D plot, but the fourth dimension (depicting R0) should be in terms of a color scheme.
In the current example, I wish to plot R0 against the three parameters beta, p, and phi which could all vary between 0 and 1. The formula for R0 and the parameters are given below.
c = 0.01;
%beta = 0.4;
gamma = 0.2;
theta = 0.2778;
%p = 0.05;
%phi = 0.95;
epsilon = 0.084;
delta = 0.011;
mu = 0.000027;
R0 = (epsilon*c*beta*theta*(mu+(1-phi)*p))/(mu*(mu+p)*(mu+epsilon)*(mu+gamma+delta))
I would highly appreciate if someone could help me on this. Thanks a lot in advance!
回答 (1 件)
Use "slice".
This will display R0 on predefined planes in 3d space.
12 件のコメント
Torsten
2023 年 1 月 15 日
You told MATLAB to plot R0 on six slices (beta=0, beta=0.1, beta=1, p=0.5, phi=0, phi=0.2) and it did.
What do you mean by "restrict R0 to be less than 5" ? You want to plot min(R0,5) ?
Bas123
2023 年 1 月 15 日
Torsten
2023 年 1 月 15 日
This is a surface plot for "Intensity" depending on two instead of three parameters. One is radius, the other axis has no name.
Use "surf" to get a plot like the one above.
Since the values for "Intensity" are between -10 and 10, it's probable that you did some mistake in the definition of R0 or that you used a different unit for "Intensity" than in the above graphics.
Bas123
2023 年 1 月 15 日
Torsten
2023 年 1 月 15 日
It might also be the plot of a fourth variable on a surface different from a plane. But it's unclear how the surface was created and what it represents. Maybe it's an isosurface of another variable - only you know.
Bas123
2023 年 1 月 17 日
If values for R0 are computed to be greater than 5, then how do you want to plot them ?
You could set the R0 values > 5 to NaN values. These values are not plotted afterwards.
Or you could set them artificially to 5.
But isn't that simply cheating ?
Bas123
2023 年 1 月 17 日
Torsten
2023 年 1 月 17 日
But if your model for R0 gives non-meaningful values, you should start modifying your model instead of modifying the results from the model, shouldn't you ?
Bas123
2023 年 1 月 17 日
カテゴリ
ヘルプ センター および File Exchange で 2-D and 3-D Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


