Skip to content

Instantly share code, notes, and snippets.

@tausen
Created January 1, 2012 13:58
Show Gist options
  • Save tausen/1547398 to your computer and use it in GitHub Desktop.
Save tausen/1547398 to your computer and use it in GitHub Desktop.
MATLAB implicit plot
% Credits to Vincent Morio
% http://www.mathworks.com/matlabcentral/newsreader/view_thread/152947
% Limits
xlims = [-5 5];
ylims = [-5 5];
zlims = [-5 5];
steps = 30;
noedge = true;
[Y,X,Z] = ...
ndgrid(...
linspace(xlims(1),xlims(2),steps),...
linspace(ylims(1),ylims(2),steps),...
linspace(zlims(1),zlims(2),steps));
impfunc = sinh(X).^2-sinh(Y).^2-1; % Function here
p = patch(isosurface(X,Y,Z,impfunc,0));
isonormals(X,Y,Z,impfunc,p);
set(p,'FaceColor','b','EdgeColor','k','FaceAlpha',0.5);
if (noedge)
set(p,'EdgeColor','none');
end
daspect([1 1 1])
axis square;
grid on;
camlight
view(-27,46);
lighting gouraud
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment