
Matlab is pretty neat, I downloaded a trial version of Matlab to try it out. I came across on Mathworld something called Heart Equation and this 3D Heart Surface which looked pretty neat and cool and hence I tried it out in MATLAB.
Here's the code :-
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clc | |
clear all | |
[x, y, z] = meshgrid(-10:0.05:10,-10:0.05:10,-10:0.05:10); | |
r = power((power(x,2) + ((9/4).*power(y,2)) + power(z,2) - 1),3) - (power(x,2).*power(z,3)) - ((9/80).*(power(y,2).*power(z,3))); | |
p = patch(isosurface(x,y,z,r,0)); | |
set(p,'facecolor','red','EdgeColor','none'); | |
daspect([1,1,1]); | |
view(3); | |
axis off; | |
camlight('right') | |
lighting phong; |