Creating Surf plot in MATLAB

2 visualizzazioni (ultimi 30 giorni)
Jonathan Asante
Jonathan Asante il 3 Apr 2018
Risposto: Walter Roberson il 4 Apr 2018
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 Commenti
Walter Roberson
Walter Roberson il 3 Apr 2018
Modificato: Walter Roberson il 4 Apr 2018
Are you wanting four surf plots, are the four values CMYK information, or are the four values RGBA information ?
Jonathan Asante
Jonathan Asante il 3 Apr 2018
Yes I would like four surf plots. And values are CMYK information.

Accedi per commentare.

Risposte (2)

KSSV
KSSV il 3 Apr 2018
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
  1 Commento
Jonathan Asante
Jonathan Asante il 4 Apr 2018
Thanks. Think I didn't express my question well. I am looking for a graph similar to the one attached.

Accedi per commentare.


Walter Roberson
Walter Roberson il 4 Apr 2018
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')

Community Treasure Hunt

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

Start Hunting!

Translated by