Ngô Quốc Anh

January 29, 2013

Say HI in MuPAD

Filed under: Linh Tinh — Tags: — Ngô Quốc Anh @ 5:37

I found this interesting note regarding to Matlab. In that note, they plotted the word HI using Matlab. Here I try to use MuPAD in order to get a slightly better picture.

As mentioned in the note, the full function we need to use is

\displaystyle e^{-x^2-\frac{1}{2}y^2} \cos(4x) + e^{-3\big( (x+\frac{1}{2})^2+\frac{1}{2}y^2 \big)}.

If you plot that full function, what you are going to have is the following picture

HI 0

The idea is to use the cut off of f within the range [-\frac{1}{1000}, \frac{1}{500}]. To achieve that goal, we use the following modified function

\displaystyle \max(\min(f,\frac{1}{1000}),-\frac{1}{500}).

Following is what you shall get.

HI 1HI 2

HI 3

HI 4

The code I have used here is the following

f := exp(-x^2-y^2/2)*cos(4*x) + exp(-3*((x+1/2)^2+y^2/2)):
plot(plot::Function3d(max(min(f,1/1000),-1/500), x = -4 .. 4, y = -6 .. 6, Mesh = [15, 15], XSubmesh = 5, YSubmesh = 5));

Enjoy.

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: