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!