什么是艺术??艺术就是画圈圈!!
这两天刷到了Hamid Naderi Yeganeh
大佬的一系列线条艺术,感觉非常惊艳,顺手就用MATLAB实现了一下。大佬的大部分作品都在以下网站,大家有兴趣可以去瞅瞅去试试实现其他的作品:
https://www.ams.org/publicoutreach/math-imagery/yeganeh
飞鸟一
This image shows 9,830 circles. For k = 1 , 2 , 3 , … , 9830 k=1,2,3, \ldots, 9830 k=1,2,3,…,9830 , the center of the circle is ( X ( k ) , Y ( k ) ) (X(k), Y(k)) (X(k),Y(k)) and the radius of the k-th circle is R ( k ) R(k) R(k) , where:
X ( k ) = ( sin ( π k 20000 ) ) 12 ( 1 2 ( cos ( 31 π k 1000 ) ) 16 sin ( 6 π k 10000 ) + 1 6 ( sin ( 31 π k 1000 ) ) 20 ) + 3 k 20000 + ( cos ( 31 π k 10000 ) ) 6 sin ( π 2 ( k − 10000 10000 ) 7 − π 5 ) Y ( k ) = − 9 4 ( cos ( 31 π k 10000 ) ) 6 cos ( π 2 ( k − 10000 10000 ) 7 − π 5 ) ( 2 3 + ( sin ( π k 20000 ) sin ( 3 π k 2000 ) ) 6 ) + 3 4 ( cos ( 3 π k − 10000 10000 ) ) 10 ( cos ( 9 π k − 10000 10000 ) ) 10 ( cos ( 36 π k − 10000 100000 ) ) 14 + 7 10 ( k − 10000 10000 ) 2 R ( k ) = ( sin ( π k 20000 ) ) 10 ( 1 4 ( cos ( 31 π k 10000 + 25 π 32 ) ) 20 + 1 20 ( cos ( 31 π k 10000 ) ) 2 ) + 1 30 ( 3 2 − ( cos ( 62 π k 10000 ) ) 2 ) X(k)=(sin(πk20000))12(12(cos(31πk1000))16sin(6πk10000)+16(sin(31πk1000))20)+3k20000+(cos(31πk10000))6sin(π2(k−1000010000)7−π5)Y(k)=−94(cos(31πk10000))6cos(π2(k−1000010000)7−π5)(23+(sin(πk20000)sin(3πk2000))6)+34(cos(3πk−1000010000))10(cos(9πk−1000010000))10(cos(36πk−10000100000))14+710(k−1000010000)2R(k)=(sin(πk20000))10(14(cos(31πk10000+25π32))20+120(cos(31πk10000))2)+130(32−(cos(62πk10000))2) X(k)=(sin(20000πk))12(21(cos(100031πk))16sin(100006πk)+61(sin(100031πk))20)+200003k+(cos(1000031πk))6sin(2π(10000k−10000)7−5π)Y(k)=4−9(cos(1000031πk))6cos(2π(10000k−10000)7−5π)(32+(sin(20000πk)sin(20003πk))6)+43(cos(3π10000k−10000))10(cos(9π10000k−10000))10(cos(36π100000k−10000))14+107(10000k−10000)2R(k)=(sin(20000πk))10(41(cos(1000031πk+3225π))20+201(cos(1000031πk))2)+301(23−(cos(1000062πk))2)
完整代码
% bird 1
K=1:9830;
t=linspace(0,2*pi,200);
X=@(k) (sin(pi.*k./2e4)).^12.*(cos(31.*pi.*k./1e4).^16.*sin(6.*pi.*k./1e4)./2+sin(31.*pi.*k./1e4).^20./6)...
+3.*k./2e4+cos(31.*pi.*k./1e4).^6.*sin(pi./2.*(k./1e4-1).^7-pi./5);
Y=@(k) -9./4.*cos(31.*pi.*k./1e4).^6.*cos(pi./2.*(k./1e4-1).^7-pi./5).*(2./3+(sin(pi.*k./2e4).*sin(3.*pi.*k./2e4)).^6)...
+3./4.*cos(3.*pi.*(k-1e4)./1e5).^10.*cos(9.*pi.*(k-1e4)./1e5).^10.*cos(36.*pi.*(k-1e4)./1e5).^14+7./10.*((k-1e4)./1e4).^2;
R=@(k) sin(pi.*k./2e4).^10.*(1./4.*cos(31.*pi.*k./1e4+25.*pi./32).^20+1./20.*cos(31.*pi.*k./1e4).^2)+1./30.*(3./2-cos(62.*pi.*k./1e4).^2);
CX=[X(K')+cos(t).*R(K'),K'.*nan]';
CY=[Y(K')+sin(t).*R(K'),K'.*nan]';
plot(CX(:),CY(:),'Color',[0,0,0,.2]);
set(gca,'DataAspectRatio',[1,1,1],'XColor','none','YColor','none');
飞鸟二
This image shows all circles of form ( x − A ( k ) ) 2 + ( y − B ( k ) ) 2 = R ( k ) 2 (x-A(k))^2+(y-B(k))^2=R(k)^2 (x−A(k))2+(y−B(k))2=R(k)2 for k = − 20000 , − 19999 , … , 20000 k=-20000,-19999,\dots,20000 k=−20000,−19999,…,20000, where:
A ( k ) = 3 k 45000 + sin ( 17 π 20 ( k 20000 ) 5 ) cos 6 ( 41 π k 20000 ) + ( 1 3 cos 16 ( 41 π k 20000 ) + 1 3 cos 80 ( 41 π k 20000 ) ) cos 12 ( π k 40000 ) sin ( 6 π k 20000 ) B ( k ) = 15 30 ( k 20000 ) 4 − cos ( 17 π 20 ( k 20000 ) 5 ) ( 11 10 + 45 20 cos 8 ( π k 40000 ) cos 6 ( 3 π k 40000 ) ) cos 6 ( 41 π k 20000 ) + 12 20 cos 10 ( 3 π k 200000 ) cos 10 ( 9 π k 200000 ) cos 10 ( 18 π k 200000 ) R ( k ) = 1 50 + 1 40 sin 2 ( 41 π k 20000 ) sin 2 ( 9 π k 200000 ) + ( 1 17 ) cos 2 ( 41 π k 20000 ) cos 10 ( π k 40000 ) A(k)=3k45000+sin(17π20(k20000)5)cos6(41πk20000)+(13cos16(41πk20000)+13cos80(41πk20000))cos12(πk40000)sin(6πk20000)B(k)=1530(k20000)4−cos(17π20(k20000)5)(1110+4520cos8(πk40000)cos6(3πk40000))cos6(41πk20000)+1220cos10(3πk200000)cos10(9πk200000)cos10(18πk200000)R(k)=150+140sin2(41πk20000)sin2(9πk200000)+(117)cos2(41πk20000)cos10(πk40000) A(k)=450003k+sin(2017π(20000k)5)cos6(2000041πk)+(31cos16(2000041πk)+31cos80(2000041πk))cos12(40000πk)sin(200006πk)B(k)=3015(20000k)4−cos(2017π(20000k)5)(1011+2045cos8(40000πk)cos6(400003πk))cos6(2000041πk)+2012cos10(2000003πk)cos10(2000009πk)cos10(20000018πk)R(k)=501+401sin2(2000041πk)sin2(2000009πk)+(171)cos2(2000041πk)cos10(40000πk)
完整代码
% bird 2
K=-2e4:2e4;
t=linspace(0,2*pi,200);
X=@(k) k./15e3+sin(17.*pi./20.*(k./2e4).^5).*cos(41.*pi.*k./2e4).^6+...
(1./3.*cos(41.*pi.*k./2e4).^16+1./3.*cos(41.*pi.*k./2e4).^80).*cos(pi.*k./4e4).^12.*sin(6.*pi.*k./2e4);
Y=@(k) 1./2.*(k./2e4).^4-cos(17.*pi./20.*(k./2e4).^5).*(11./10+45./20.*cos(pi.*k./4e4).^8.*cos(3.*pi.*k./4e4).^6).*cos(41.*pi.*k./2e4).^6+...
12./20.*cos(3.*pi.*k./2e5).^10.*cos(9.*pi.*k./2e5).^10.*cos(8.*pi.*k./2e5).^10;
R=@(k) 1./50+1./40.*sin(41.*pi.*k./2e4).^2.*sin(9.*pi.*k./2e5).^2+1./17.*cos(41.*pi.*k./2e4).^2.*cos(pi.*k./4e4).^10;
CX=[X(K')+cos(t).*R(K'),K'.*nan]';
CY=[Y(K')+sin(t).*R(K'),K'.*nan]';
plot(CX(:),CY(:),'Color',[0,0,0,.2]);
set(gca,'DataAspectRatio',[1,1,1],'XColor','none','YColor','none');
蝴蝶一
This image shows 40000 circles. For k = 1 , 2 , 3 , … , 40000 k=1,2,3, \ldots, 40000 k=1,2,3,…,40000 , the center of the circle is ( X ( k ) , Y ( k ) ) (X(k), Y(k)) (X(k),Y(k)) and the radius of the k-th circle is R ( k ) R(k) R(k) , where:
X ( k ) = ( 3 / 2 ) ( ( cos ( 141 π k / 40 , 000 ) ) 9 ) ∗ ( 1 − ( 1 / 2 ) sin ( π k / 40 , 000 ) ) ∗ ( 1 − ( 1 / 4 ) ( ( cos ( 2 π k / 40 , 000 ) ) 30 ) ∗ ( 1 + ( cos ( 32 π k / 40 , 000 ) ) 20 ) ) ∗ ( 1 − ( 1 / 2 ) ( ( sin ( 2 π k / 40 , 000 ) ) 30 ) ∗ ( ( sin ( 6 π k / 40 , 000 ) ) 10 ) ∗ ( ( 1 / 2 ) + ( 1 / 2 ) ( sin ( 18 π k / 40 , 000 ) ) 20 ) ) Y ( k ) = cos ( 2 π k / 40 , 000 ) ∗ ( ( cos ( 141 π k / 40 , 000 ) ) 2 ) ∗ ( 1 + ( 1 / 4 ) ( ( cos ( π k / 40 , 000 ) ) 24 ) ∗ ( ( cos ( 3 π k / 40 , 000 ) ) 24 ) ∗ ( cos ( 21 π k / 40 , 000 ) ) 24 ) R ( k ) = ( 1 / 100 ) + ( 1 / 40 ) ( ( ( cos ( 141 π k / 40 , 000 ) ) 14 ) + ( sin ( 141 π k / 40 , 000 ) ) 6 ) ∗ ( 1 − ( ( cos ( π k / 40 , 000 ) ) 16 ) ( ( cos ( 3 π k / 40 , 000 ) ) 16 ) ∗ ( cos ( 12 π k / 40 , 000 ) ) 16 ) . X(k)=(3/2)((cos(141πk/40,000))9)∗(1−(1/2)sin(πk/40,000))∗(1−(1/4)((cos(2πk/40,000))30)∗(1+(cos(32πk/40,000))20))∗(1−(1/2)((sin(2πk/40,000))30)∗((sin(6πk/40,000))10)∗((1/2)+(1/2)(sin(18πk/40,000))20))Y(k)=cos(2πk/40,000)∗((cos(141πk/40,000))2)∗(1+(1/4)((cos(πk/40,000))24)∗((cos(3πk/40,000))24)∗(cos(21πk/40,000))24)R(k)=(1/100)+(1/40)(((cos(141πk/40,000))14)+(sin(141πk/40,000))6)∗(1−((cos(πk/40,000))16)((cos(3πk/40,000))16)∗(cos(12πk/40,000))16). X(k)=Y(k)=R(k)=(3/2)((cos(141πk/40,000))9)∗(1−(1/2)sin(πk/40,000))∗(1−(1/4)((cos(2πk/40,000))30)∗(1+(cos(32πk/40,000))20))∗(1−(1/2)((sin(2πk/40,000))30)∗((sin(6πk/40,000))10)∗((1/2)+(1/2)(sin(18πk/40,000))20))cos(2πk/40,000)∗((cos(141πk/40,000))2)∗(1+(1/4)((cos(πk/40,000))24)∗((cos(3πk/40,000))24)∗(cos(21πk/40,000))24)(1/100)+(1/40)(((cos(141πk/40,000))14)+(sin(141πk/40,000))6)∗(1−((cos(πk/40,000))16)((cos(3πk/40,000))16)∗(cos(12πk/40,000))16).
完整代码
% butterfly 1
K=1:4e4;
t=linspace(0,2*pi,200);
X=@(k) 3./2.*cos(141.*pi.*k./4e4).^9.*(1-1./2.*sin(pi.*k./4e4)).*(1-1./4.*cos(2.*pi.*k./4e4).^30.*(1+cos(32.*pi.*k./4e4).^20)).*...
(1-1./2.*sin(2.*pi.*k./4e4).^30.*sin(6.*pi.*k./4e4).^10.*(1./2+1./2.*sin(18.*pi.*k./4e4).^20));
Y=@(k) cos(2.*pi.*k./4e4).*cos(141.*pi.*k./4e4).^2.*(1+1./4.*cos(pi.*k./4e4).^24.*cos(3.*pi.*k./4e4).^24.*cos(21.*pi.*k./4e4).^24);
R=@(k) 1./100+1./40.*(cos(141.*pi.*k./4e4).^14+sin(141.*pi.*k./4e4).^6).*(1-cos(pi.*k./4e4).^16.*cos(3.*pi.*k./4e4).^16.*cos(12.*pi.*k./4e4).^16);
CX=[X(K')+cos(t).*R(K'),K'.*nan]';
CY=[Y(K')+sin(t).*R(K'),K'.*nan]';
plot(CX(:),CY(:),'Color',[0,0,0,.2]);
set(gca,'DataAspectRatio',[1,1,1],'XColor','none','YColor','none');
蝴蝶二
This image shows 40000 circles. For k = 1 , 2 , 3 , … , 40000 k=1,2,3, \ldots, 40000 k=1,2,3,…,40000 , the center of the circle is ( X ( k ) , Y ( k ) ) (X(k), Y(k)) (X(k),Y(k)) and the radius of the k-th circle is R ( k ) R(k) R(k) , where:
X ( k ) = ( 6 / 5 ) ( ( cos ( 141 π k / 40 , 000 ) ) 9 ) ( 1 − ( 1 / 2 ) ( sin ( π k / 40 , 000 ) ) 3 ) ∗ ( 1 − ( 1 / 4 ) ( ( cos ( 2 π k / 40 , 000 ) ) 30 ) ( 1 + ( 2 / 3 ) ( cos ( 30 π k / 40 , 000 ) ) 20 ) − ( ( sin ( 2 π k / 40 , 000 ) ) 10 ) ( ( sin ( 6 π k / 40 , 000 ) ) 10 ) ∗ ( ( 1 / 5 ) + ( 4 / 5 ) ( cos ( 24 π k / 40 , 000 ) ) 20 ) ) Y ( k ) = cos ( 2 π k / 40 , 000 ) ( ( cos ( 141 π k / 40 , 000 ) ) 2 ) ( 1 + ( 1 / 4 ) ( ( cos ( π k / 40 , 000 ) ) 24 ) ∗ ( ( cos ( 3 π k / 40 , 000 ) ) 24 ) ( cos ( 19 π k / 40 , 000 ) ) 24 ) R ( k ) = ( 1 / 100 ) + ( 1 / 40 ) ( ( ( cos ( 2820 π k / 40 , 000 ) ) 6 ) + ( sin ( 141 π k / 40 , 000 ) ) 2 ) ( 1 − ( ( cos ( π k / 40 , 000 ) ) 16 ) ∗ ( ( cos ( 3 π k / 40 , 000 ) ) 16 ) ( cos ( 12 π k / 40 , 000 ) ) 16 ) . X(k)=(6/5)((cos(141πk/40,000))9)(1−(1/2)(sin(πk/40,000))3)∗(1−(1/4)((cos(2πk/40,000))30)(1+(2/3)(cos(30πk/40,000))20)−((sin(2πk/40,000))10)((sin(6πk/40,000))10)∗((1/5)+(4/5)(cos(24πk/40,000))20))Y(k)=cos(2πk/40,000)((cos(141πk/40,000))2)(1+(1/4)((cos(πk/40,000))24)∗((cos(3πk/40,000))24)(cos(19πk/40,000))24)R(k)=(1/100)+(1/40)(((cos(2820πk/40,000))6)+(sin(141πk/40,000))2)(1−((cos(πk/40,000))16)∗((cos(3πk/40,000))16)(cos(12πk/40,000))16). X(k)=Y(k)=R(k)=(6/5)((cos(141πk/40,000))9)(1−(1/2)(sin(πk/40,000))3)∗(1−(1/4)((cos(2πk/40,000))30)(1+(2/3)(cos(30πk/40,000))20)−((sin(2πk/40,000))10)((sin(6πk/40,000))10)∗((1/5)+(4/5)(cos(24πk/40,000))20))cos(2πk/40,000)((cos(141πk/40,000))2)(1+(1/4)((cos(πk/40,000))24)∗((cos(3πk/40,000))24)(cos(19πk/40,000))24)(1/100)+(1/40)(((cos(2820πk/40,000))6)+(sin(141πk/40,000))2)(1−((cos(πk/40,000))16)∗((cos(3πk/40,000))16)(cos(12πk/40,000))16).
完整代码
% butterfly 2
K=1:4e4;
t=linspace(0,2*pi,200);
X=@(k) 6./5.*cos(141.*pi.*k./4e4).^9.*(1-1./2.*sin(pi.*k./4e4).^3).*(1-1./4.*cos(2.*pi.*k./4e4).^30.*(1+2./3.*cos(30.*pi.*k./4e4).^20)-...
sin(2.*pi.*k./4e4).^10.*sin(6.*pi.*k./4e4).^10.*(1./5+4./5.*cos(24.*pi.*k./4e4).^20));
Y=@(k) cos(2.*pi.*k./4e4).*cos(141.*pi.*k./4e4).^2.*(1+1./4.*cos(pi.*k./4e4).^24.*cos(3.*pi.*k./4e4).^24.*cos(19.*pi.*k./4e4).^24);
R=@(k) 1./100+1./40.*(cos(2820.*pi.*k./4e4).^6+sin(141.*pi.*k./4e4).^2).*(1-cos(pi.*k./4e4).^16.*cos(3.*pi.*k./4e4).^16.*cos(12.*pi.*k./4e4).^16);
CX=[X(K')+cos(t).*R(K'),K'.*nan]';
CY=[Y(K')+sin(t).*R(K'),K'.*nan]';
plot(CX(:),CY(:),'Color',[0,0,0,.2]);
set(gca,'DataAspectRatio',[1,1,1],'XColor','none','YColor','none');
橄榄枝
This image shows 4000 circles. For k = 1 , 2 , 3 , … , 4000 k=1,2,3, \ldots, 4000 k=1,2,3,…,4000 , the center of the circle is ( X ( k ) , Y ( k ) ) (X(k), Y(k)) (X(k),Y(k)) and the radius of the k-th circle is R ( k ) R(k) R(k) , where:
X ( k ) = ( 2 k / 4000 ) + ( 1 / 28 ) sin ( 42 π k / 4000 ) + ( 1 / 9 ) ( ( sin ( 21 π k / 4000 ) ) 8 ) + ( 1 / 4 ) ( ( sin ( 21 π k / 4000 ) ) 6 ) ∗ sin ( ( 2 π / 5 ) ( k / 4000 ) 12 ) Y ( k ) = ( 1 / 4 ) ( k / 4000 ) 2 + ( 1 / 4 ) ( ( ( sin ( 21 π k / 4000 ) ) 5 ) + ( 1 / 28 ) sin ( 42 π k / 4000 ) ) ∗ ( cos ( ( π / 2 ) ( k / 4000 ) 12 ) ) R ( k ) = ( 1 / 170 ) + ( 1 / 67 ) ( ( sin ( 42 π k / 4000 ) ) 2 ) ∗ ( 1 − ( ( cos ( 21 π k / 4000 ) ) 4 ) ) . X(k)=(2k/4000)+(1/28)sin(42πk/4000)+(1/9)((sin(21πk/4000))8)+(1/4)((sin(21πk/4000))6)∗sin((2π/5)(k/4000)12)Y(k)=(1/4)(k/4000)2+(1/4)(((sin(21πk/4000))5)+(1/28)sin(42πk/4000))∗(cos((π/2)(k/4000)12))R(k)=(1/170)+(1/67)((sin(42πk/4000))2)∗(1−((cos(21πk/4000))4)). X(k)=Y(k)=R(k)=(2k/4000)+(1/28)sin(42πk/4000)+(1/9)((sin(21πk/4000))8)+(1/4)((sin(21πk/4000))6)∗sin((2π/5)(k/4000)12)(1/4)(k/4000)2+(1/4)(((sin(21πk/4000))5)+(1/28)sin(42πk/4000))∗(cos((π/2)(k/4000)12))(1/170)+(1/67)((sin(42πk/4000))2)∗(1−((cos(21πk/4000))4)).
完整代码
% olive
K=1:4e3;
t=linspace(0,2*pi,200);
X=@(k) 2.*k./4e3+1./28.*sin(42.*pi.*k./4e3)+1./9.*sin(21.*pi.*k./4e3).^8+1./4.*sin(21.*pi.*k./4e3).^6.*sin(2.*pi./5.*(k./4e3).^12);
Y=@(k) 1./4.*(k./4e3).^2+1./4.*(sin(21.*pi.*k./4e3).^5+1./28.*sin(41.*pi.*k./4e3)).*cos(pi./2.*(k./4e3).^12);
R=@(k) 1./170+1./67.*sin(42.*pi.*k./4e3).^2.*(1-cos(21.*pi.*k./4e3).^4);
CX=[X(K')+cos(t).*R(K'),K'.*nan]';
CY=[Y(K')+sin(t).*R(K'),K'.*nan]';
plot(CX(:),CY(:),'Color',[0,0,0,.2]);
set(gca,'DataAspectRatio',[1,1,1],'XColor','none','YColor','none');
当然除了画圈圈,该网站上还有一些其他有趣的图形,可以自行去查看,最后,给大家比个心~
心形
This image shows the following curve:
X ( t ) = 4 9 sin ( 2 t ) + 1 3 ( sin ( t ) ) 8 cos ( 3 t ) + 1 8 sin ( 2 t ) ( cos ( 247 t ) ) 4 Y ( t ) = sin ( t ) + 1 3 ( sin ( t ) ) 8 sin ( 3 t ) + 1 8 sin ( 2 t ) ( sin ( 247 t ) ) 4 , 0 ≤ t ≤ π X(t)=49sin(2t)+13(sin(t))8cos(3t)+18sin(2t)(cos(247t))4Y(t)=sin(t)+13(sin(t))8sin(3t)+18sin(2t)(sin(247t))4,0≤t≤π X(t)=94sin(2t)+31(sin(t))8cos(3t)+81sin(2t)(cos(247t))4Y(t)=sin(t)+31(sin(t))8sin(3t)+81sin(2t)(sin(247t))4,0≤t≤π
完整代码
% heart
t=linspace(0,pi,5e3);
X=@(t) 4./9.*sin(2.*t)+1./3.*sin(t).^8.*cos(3.*t)+1./8.*sin(2.*t).*cos(247.*t).^4;
Y=@(t) sin(t)+1./3.*sin(t).^8.*sin(3.*t)+1./8.*sin(2.*t).*sin(247.*t).^4;
hLine=plot(X(t),Y(t),'-','LineWidth',1);
colorNum=length(hLine.XData);
colorData=uint8([(pink(colorNum).*255)';255+t.*0]);
pause(1e-16)
set(hLine.Edge,'ColorBinding','interpolated', 'ColorData',colorData)
set(gca,'DataAspectRatio',[1,1,1],'XColor','none','YColor','none');
转载:https://blog.csdn.net/slandarer/article/details/127702433