Peter Jung
Peter Jung

Reputation: 255

Surface between contour lines in 3D

I have code like this:

load('something.mat');
[X,Y] = meshgrid(tx,ty);

tt1 = U_TV1(:,:,1);
tt2=U_TV1( :,:,2);
tt3=U_TV1( :,:,3);

figure(2);
% surf(X, Y, tt1, 'FaceAlpha', 0.3);
shading interp;
hold on;
e = [1 3]; % [ .001  .1 .3  1  3 10 ]; % epsilon
[c1, h1] = contour3(X, Y, tt1, e, 'r');
[c2, h2] = contour3(X, Y, tt2, e, 'b');
[c3, h3] = contour3(X, Y, tt3, e, 'g');
% legend('k=1', 'k=2', 'k=3');
clabel(c1, h1, e, 'fontsize', 10, 'fontweight', 'bold');
clabel(c2, h2, e, 'fontsize', 10, 'fontweight', 'bold');
clabel(c3, h3, e, 'fontsize', 10, 'fontweight', 'bold');
zlim([0 15]);

And the result is following 3D plot:

Plot from Matlab

How I can fill space (draw surface) between contours with the same number ?

I would like to have something like this (made with Paint):

Output I want

Thanks for any help.

Upvotes: 1

Views: 63

Answers (1)

m7913d
m7913d

Reputation: 11064

The solution consists out of two steps:

  1. Extract the points/lines through which you want to fit a plot
  2. Fit a surface through that points using fit

Upvotes: 1

Related Questions