Skip to content

Instantly share code, notes, and snippets.

@caiorss
Forked from tausen/gist:1547398
Created December 25, 2016 21:21
Show Gist options
  • Save caiorss/c55932501f14600b6d09a1f1ab2719e3 to your computer and use it in GitHub Desktop.
Save caiorss/c55932501f14600b6d09a1f1ab2719e3 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