Beating (cartoon) Heart

Fun Valentine's Day animation: An implicit "heart" surface is diffused forwards and backwards to simulate (cartoon) heart beating.
Updated 6 Feb 2019

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

The implicit heart surface Phi=2-(2*X.^2 + Y.^2 + Z.^2 -1).^3 + 0.2*X.^2.*Z.^3 + Y.^2.*Z.^3 is diffused using the 3-D heat partial differential equation in a periodic box via the Fourier spectral method. After using fft's to handle the space derivatives, the remaining ordinary differential equation has an analytic solution in time. Once melted, the solution is run in reverse to simulate beating (this reversal part added by Luke Dosiek).

Cite As

Nathaniel Barlow (2024). Beating (cartoon) Heart (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2016a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Cardiology in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes