"matlab" dynamic drawing of three-dimensional heart-shape diagram __matlab

Source: Internet
Author: User
[Reprint]matlab Dynamic drawing three-dimensional heart shape diagram

Matlab Dynamic drawing three-dimensional heart chart program as follows, the core is the Isosurface function, Verts stores the coordinates of the heart surface points, and faces stores the connection order of each point.
Clear
filename= ' heart ';
[X,y,z]=meshgrid (Linspace ( -3,3)); 
P= (x.^2+ (9/4) *y.^2+z.^2-1). ^3-x.^2.*z.^3-(9/80) *y.^2.*z.^3; 
[Faces,verts,colors] = Isosurface (x,y,z,p,0,x);
For I=1:9
figure (i)
pp=patch (' Faces ', Faces (1:284+i*1000,:), ' vertices ', Verts);
Set (PP, ' facecolor ', ' Red ', ' edgecolor ', ' none ');
View ( -30,24)
axis off
axis equal
axis tight
camlight
lighting Gouraud
Pause (0.5)
f (i) = GetFrame (i);
Imind = Frame2im (f (i));
[IMIND,CM] = Rgb2ind (imind,256);
if i = = 1
 
        imwrite (imind,cm,filename, ' gif ', ' Loopcount ', INF, ' Delaytime ', 0.5);
 
else
 
        imwrite (imind,cm,filename, ' gif ', ' writemode ', ' append ', ' delaytime ', 0.5);
 
End Close
(i)
End


End

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.