Creating Surf plot in MATLAB
2 次查看(过去 30 天)
显示 更早的评论
Would be most grateful if anyone can provide help with creating a surf plot using the comma separated txt file (Attached). I am trying to make the first column x-axis, the second as y-axis and the remaining four columns as the z-values.
2 个评论
Walter Roberson
2018-4-3
编辑:Walter Roberson
2018-4-4
Are you wanting four surf plots, are the four values CMYK information, or are the four values RGBA information ?
回答(2 个)
KSSV
2018-4-3
Let your data be in a text file named data.txt
data = importdata('data.txt') ;
x = data(:,1) ;
y = data(:,2) ;
z = data(:,3:end) ;
dt = delaunayTriangulation(x,y) ;
tri = dt.ConnectivityList ;
for i = 1:size(z,2)
trisurf(tri,x,y,z(:,i))
shading interp
colorbar
view(2)
pause(0.5)
end
Walter Roberson
2018-4-4
Then
data = load('CoopStrategyNumGraph.txt');
d11 = reshape(data,11,11,6);
X = d11(:,:,1);
Y = d11(:,:,2);
I_cmyk = d11(:,:,3:6);
inprof = iccread('USSheetfedCoated.icc'); %you need to download this from somewhere
outprof = iccread('sRGB.icc');
C = makecform('icc',inprof,outprof);
I_rgb = applycform(I_cmyk,C);
image(X(1,[1 end]),Y([1 end],1),I_rgb)
title('cmyk to rgb')
figure
subplot(2,2,1)
surf(X, Y, d11(:,:,3));
title('column 3')
subplot(2,2,2)
surf(X, Y, d11(:,:,4));
title('column 4');
subplot(2,2,3)
surf(X, Y, d11(:,:,5));
title('column 5');
subplot(2,2,4)
surf(X, Y, d11(:,:,6));
title('column 6')
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!