- /
-
Creating Butterflies using Mathematics Formula (Parametric Equation)
on 14 Oct 2024
- 78
- 842
- 1
- 0
- 1532
Song title "Fireflies" by Owl City
drawframe(1);
Write your drawframe function below
% Using Mathematics we can create any objects and their simulation
% Graph of Equation created by Dhimas Mahardika S.Si., M.Mat.
% from
% Sanggung Utara, Jatingaleh, Candisari, Semarang
% Universitas Nasional Karangturi Semarang
% Universitas Diponegoro Tembalang
function drawframe(f)
t = linspace(0,2*pi);
h = linspace(0,2*pi,96);
h1= linspace(0.25,6*pi+0.25,96);
a=h(f)
a1=h1(f)
p=sin(t-0.07).*((cos(t-0.16)).^2).*sin(t)
q=0.8*sin(t-0.07).*((cos(t-0.16)).^2).*cos(t)
p1=p.*sin(a1)
q1=-p.*cos(a1)
x=p1
y=q.*sin(a)+(q1-0.7).*cos(a)
z=(q1-0.7).*sin(a)-q.*cos(a)
x1=-p1
y1=q.*sin(a)+(q1-0.7).*cos(a)
z1=(q1-0.7).*sin(a)-q.*cos(a)
x2=0.7*p1
y2=0.7*q.*sin(a) + 0.7*(q1-1).*cos(a)
z2=0.7*(q1-1).*sin(a) - 0.7*q.*cos(a)
x3=-0.7*p1
y3=0.7*q.*sin(a) + 0.7*(q1-1).*cos(a)
z3=0.7*(q1-1).*sin(a) - 0.7*q.*cos(a)
x4=0.4*p1
y4=0.4*q.*sin(a) + 0.4*(q1-1.75).*cos(a)
z4=0.4*(q1-1.75).*sin(a) - 0.4*q.*cos(a)
x5=-0.4*p1
y5=0.4*q.*sin(a) + 0.4*(q1-1.75).*cos(a)
z5=0.4*(q1-1.75).*sin(a) - 0.4*q.*cos(a)
x6=p1
y6=q.*sin(a+(pi/2))+(q1-0.7).*cos(a+(pi/2))
z6=(q1-0.7).*sin(a+(pi/2))-q.*cos(a+(pi/2))
x7=-p1
y7=q.*sin(a+(pi/2))+(q1-0.7).*cos(a+(pi/2))
z7=(q1-0.7).*sin(a+(pi/2))-q.*cos(a+(pi/2))
x8=0.7*p1
y8=0.7*q.*sin(a+(pi/2)) + 0.7*(q1-1).*cos(a+(pi/2))
z8=0.7*(q1-1).*sin(a+(pi/2)) - 0.7*q.*cos(a+(pi/2))
x9=-0.7*p1
y9=0.7*q.*sin(a+(pi/2)) + 0.7*(q1-1).*cos(a+(pi/2))
z9=0.7*(q1-1).*sin(a+(pi/2)) - 0.7*q.*cos(a+(pi/2))
x10=0.4*p1
y10=0.4*q.*sin(a+(pi/2)) + 0.4*(q1-1.75).*cos(a+(pi/2))
z10=0.4*(q1-1.75).*sin(a+(pi/2)) - 0.4*q.*cos(a+(pi/2))
x11=-0.4*p1
y11=0.4*q.*sin(a+(pi/2)) + 0.4*(q1-1.75).*cos(a+(pi/2))
z11=0.4*(q1-1.75).*sin(a+(pi/2)) - 0.4*q.*cos(a+(pi/2))
plot3(x,y,z,x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4,x5,y5,z5,...
x6,y6,z6,x7,y7,z7,x8,y8,z8,x9,y9,z9,x10,y10,z10,x11,y11,z11,'LineWidth',2,'Color',[1 0 0])
MeshDensity=5555
axis equal
axis([-0.5 0.5 -1.05 1.05 -1.05 1.05])
end