BATMAN Equation on MATLAB

Standard

 

As a Junior college student I always used to think if the Batman logo can be plotted on a graph in real life with a possible equation for it with the BATMAN logo equation circulating online. I was first wasn’t sure of the originality of the equation and always believed that “Salla Koi IIT wala hoga jo bore hoke equation banaya hoga” ( I was still in JC)

Now during my Summer Internship I was introduced to MATLAB. For once I used to think,”Oh MATLAB, yeah I know it!” (I thought as if i knew everything about it just because I heard people using it a lot and made me think as if I know it too(Human tendency)). But this time it was different as I had to use it for real and give some result. So I started Exploring it in and out and was in awe by the number of things MATLAB does for you.

One thing specially I would like to mention would be to just type “bench” in the Code window and see the rest.

MATLAB Bench() Benchmark

Two days into using it, It occurred to me that is time to decode the BATMAN equation using MATLAB plot functions and so started my search for finding a way to do it began.

And Here you go! The equation proved its existence for Real and I just couldn’t stop praising MATLAB

Batman equation by me

The whole code:


 

clf; clear; syms x y

 

 

e1 = ((x/7)^2*sqrt(abs(abs(x)-3)/(abs(x)-3))+(y/3)^2*sqrt(abs(y+3/7*sqrt(33))/(y+3/7*sqrt(33)))-1);

 

e2 = (abs(x/2)-((3*sqrt(33)-7)/112)*x^2-3+sqrt(1-(abs(abs(x)-2)-1)^2)-y);

 

e3 = (9*sqrt(abs((abs(x)-1)*(abs(x)-.75))/((1-abs(x))*(abs(x)-.75)))-8*abs(x)-y);

 

e4 = (3*abs(x)+.75*sqrt(abs((abs(x)-.75)*(abs(x)-.5))/((.75-abs(x))*(abs(x)-.5)))-y);

 

e5 = (2.25*sqrt(abs((x-.5)*(x+.5))/((.5-x)*(.5+x)))-y);

 

e6 = (6*sqrt(10)/7+(1.5-.5*abs(x))*sqrt(abs(abs(x)-1)/(abs(x)-1))-(6*sqrt(10)/14)*sqrt(4-(abs(x)-1)^2)-y);

 

 

Equation = '((x/7)^2*sqrt(abs(abs(x)-3)/(abs(x)-3))+(y/3)^2*sqrt(abs(y+(3*sqrt(33))/7)/(y+(3*sqrt(33))/7))-1)*(abs(x/2)-((3*sqrt(33)-7)/112)*x^2-3+sqrt(1-(abs(abs(x)-2)-1)^2)-y)*(9*sqrt(abs((abs(x)-1)*(abs(x)-3/4))/((1-abs(x))*(abs(x)-3/4)))-8*abs(x)-y)*(3*abs(x)+3/4*sqrt(abs((abs(x)-3/4)*(abs(x)-1/2))/((3/4-abs(x))*(abs(x)-1/2)))-y)*(9/4*sqrt(abs((x-1/2)*(x + 1/2))/((1/2-x)*(1/2+x)))-y)*((6*sqrt(10))/7+(3/2-abs(x)/2)*sqrt(abs(abs(x)-1)/(abs(x)-1))-(6*sqrt(10))/14*sqrt(4-(abs(x)-1)^2)-y)=0';

 

 

axes('Xlim', [-7.25 7.25], 'Ylim', [-5 5]);

 

hold on

 

ezplot(eq1,[-8 8 -3*sqrt(33)/7 6-4*sqrt(33)/7]);

 

ezplot(eq2,[-3.5 4.2]);

 

ezplot(eq3,[-1.0 -0.75 -5 5]);

 

ezplot(eq3,[0.75 1 -5 5]);

 

ezplot(eq4,[-0.75 0.75 2.25 5]);

 

ezplot(eq5,[-0.5 0.5 -5 5]);

 

ezplot(eq6,[-3 -1 -5 5]);

 

ezplot(eq6,[1 3 -5 5]);

 

 

title('Batman');

 

xlabel('');

 

ylabel('');

 

hold off

 

 

figure

 

axes('Xlim', [-7.20 7.20], 'Ylim', [-4.5 5]);

 

hold on

 

ezplot(Equation, [-6.5 7 -3 2]);

 


To simplify it a little bit :

 

 

 

Equation 1:((x/7)^2*sqrt(abs(abs(x)-3)/(abs(x)-3))+(y/3)^2*sqrt(abs(y+3/7*sqrt(33))/(y+3/7*sqrt(33)))-1);

 

 

eq1

 

 

Equation 2:(abs(x/2)-((3*sqrt(33)-7)/112)*x^2-3+sqrt(1-(abs(abs(x)-2)-1)^2)-y);       eq2

 

Equation 3: (9*sqrt(abs((abs(x)-1)*(abs(x)-.75))/((1-abs(x))*(abs(x)-.75)))-8*abs(x)-y);

 

eq3

 

 Equation 4: (3*abs(x)+.75*sqrt(abs((abs(x)-.75)*(abs(x)-.5))/((.75-abs(x))*(abs(x)-.5)))-y);

 

eq4

 

Equation 5 = (2.25*sqrt(abs((x-.5)*(x+.5))/((.5-x)*(.5+x)))-y);
eq5

 

Equation 6 =  (6*sqrt(10)/7+(1.5-.5*abs(x))*sqrt(abs(abs(x)-1)/(abs(x)-1))-(6*sqrt(10)/14)*sqrt(4-(abs(x)-1)^2)-y);

 

eq6

 

 

X-plore MATLAB and share your experience too.

 

 

P.S: If you are wondering how much did i praised MATLAB then for the record it is 9 times. Make it 10 now

 

 

 

 

 

 

Source of Inspiration:  Math Stackexchange || traeblin

Leave a comment