user1640255
user1640255

Reputation: 1304

Set an image on the side walls of a 3d surf plot

I would like to set images on the side walls of a surf plot.

For example, the next script:

[X,Y] = meshgrid(-8:.5:8); 

R = sqrt(X.^2 + Y.^2) + eps;

Z = sin(R)./R;

surf(X,Y,Z)

colormap hsv

alpha(.4)

I would like to set an image on the walls; not to be white. I tried to do a projection of the current surface but without success. Any idea? Anyone has ever tried that?

Upvotes: 0

Views: 503

Answers (1)

David
David

Reputation: 8459

Is this something like you were looking for?

a=-8:.5:8;
[X,Y] = meshgrid(a); 

R = sqrt(X.^2 + Y.^2) + eps;

Z = sin(R)./R;
hold off
surf(X,Y,Z)
hold on
colormap hsv
alpha(.4)

zMaxY=max(Z);
zMaxX=max(Z,[],2)';
zMinY=min(Z);
zMinX=min(Z,[],2)';

surf([a;a]',8*ones(size([a;a]))',[zMaxY;zMinY]')
alpha(.4)
surf([a;a]',-8*ones(size([a;a]))',[zMaxY;zMinY]')
alpha(.4)
surf(8*ones(size([a;a]))',[a;a]',[zMaxX;zMinX]')
alpha(.4)
surf(-8*ones(size([a;a]))',[a;a]',[zMaxX;zMinX]')
alpha(.4)

Upvotes: 1

Related Questions