Plot a 3D map surface with xyzz, where I want one of the z-axis to be the color bar and the other 3 variables to be the axis

3 views (last 30 days)
Heba Morgan
Heba Morgan on 28 Jan 2022
Commented: Heba Morgan on 28 Jan 2022
I have the values, where first column is time, 2nd is temperature, 3rd is particle size, then the yield. I want the yield to be the color bar and the first 3 column to be the axis xyz
0.1846, 400, 0.42, 12
0.1846, 500, 0.42, 13.9
0.1846, 600 , 0.42 , 15.7
0.4 , 500, 1.5, 2.77
4.4, 550, 0.55, 16.43
37.11, 450, 0.55 , 28.04
37.11, 550, 0.55 , 24.47

Accepted Answer

DGM
DGM on 28 Jan 2022
If I'm understanding this correctly:
A = [0.1846 400 0.42 12;
0.1846 500 0.42 13.9;
0.1846 600 0.42 15.7;
0.4 500 1.5 2.77;
4.4 550 0.55 16.43;
37.11 450 0.55 28.04;
37.11 550 0.55 24.47];
xf = linspace(min(A(:,1)),max(A(:,1)),100);
yf = linspace(min(A(:,2)),max(A(:,2)),100).';
z = griddata(A(:,1),A(:,2),A(:,3),xf,yf,'linear');
c = griddata(A(:,1),A(:,2),A(:,4),xf,yf,'natural');
surf(xf,yf,z,c); hold on
scatter3(A(:,1),A(:,2),A(:,3),50,'k')
colorbar
colormap(parula)
shading flat

More Answers (0)

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!