Wednesday, January 21, 2015

How to Make a Heart Curve using Simulink

Hello guys, well I have a lot of free time right now and I have no idea what to do to killing time so I decided to open Matlab in my computer and draw some stuff... using Simulink! Hahaha.

I created a .mdl file that can draw heart curve in 2-D plane. You know that the valentine day is approaching right? Give her/him a hand-made chocolate is too mainstream, I guess. So why don't you try this one? I think it is not too hard to do even though you are beginner. If you really have no idea how to use Simulink, there's still plenty of time for you to practice right?

So, this is the steps to draw a heart curve in 2-D plane using Simulink:
1. First, you need to know the heart curve formula. You can find the formula in here, Heart Curve Formula. Thanks to Weisstein, Eric W. you make it more easier.
2. Now, open Matlab in your computer > open Simulink > open new model. You will be faced by a blank space. The picture below shows my final model. I make it colorful to make it easier for you to understand. You can choose any heart shaped curve you prefer among those available 6 heart shaped curve, but I'll choose the perfect one.

3. Next step is create the model from available blocks in the Simulink library. This is a block cluster inside the blue box. It represents equation x=16sin^3(t).
4. Then, this is a block cluster inside the red box. It represents equation y=13cos(t)-5cos(2t)-2cos(3t)-cos(4t).

5. Then, you need to connect the ouput X and Y in "XY Graph", the green one, block.
6. For the input, you just need to use block "Clock", the cyan one.
7. Now, run the program by pressing (Ctrl+T) and see the magic happens.

So, what are you waiting for? Open your Matlab, create this and send it to your love one. You can thank me later.

P.S.: Please let me know if you have something on your mind regarding to this tutorial or if you need to see my .mdl file, you can leave your comment below.

No comments: