Hi,
I am relatively new to Matlab. I have a figure (attached) which has two surfaces . I want to create legend for each surface. Any idea/suggestion how I can create legend for each surface? I have the attached the figure.
This is my code to create this graph
close allclear variablesclctest = xlsread('Matlabinput.xlsx', 'c2:f20');x=test(:,1);y=test(:,2);z=test(:,3);v=test(:,4);xlin = linspace(min(x),max(x),13);ylin = linspace(min(y),max(y),13);[X,Y] = meshgrid(xlin,ylin);f = scatteredInterpolant(x,y,z);f2 = scatteredInterpolant(x,y,v);Z = f(X,Y);Z2 = f2(X,Y);figuremesh(X,Y,Z); %interpolated
axis tight ;hold on;surf( X, Y, Z, 'EdgeColor', 'black', 'FaceColor', [255,100,0]/255, 'FaceAlpha', .5 );plot3(x,y,z,'.' );axis tight; mesh(X,Y,Z2) %interpolatedaxis tight; surf( X, Y, Z2, 'EdgeColor', 'black', 'FaceColor', [1,255,200]/255, 'FaceAlpha', .9);plot3(x,y,v,'.' ) %nonuniform
%hold on
xlabel('h')ylabel('s')zlabel('tc')alpha(0.5) %transparent
Thanks in advance.
Best,
Roni
Best Answer