Thursday, July 2, 2015

3D Heart Surface in MATLAB


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 :-

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;

Related Posts:

  • 3D Heart Surface in MATLAB 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 thi… Read More

Follow Me!

Followers

Visitor Map

18 Pageviews
Mar. 11th - Apr. 11th