Zoidberg curve, can't reach “zoidberg” solution

前端 未结 1 687
庸人自扰
庸人自扰 2021-02-03 21:10

I am trying to plot the Zoidberg curve in Matlab just for fun.

I just copied the equation shown there and defined the sgn and theta functions b

1条回答
  •  野性不改
    2021-02-03 21:24

    I'm not sure if it's the final solution, but it's close:

    First thing your functions are all wrong. You need the value of the array, not of elements.

    Second, use matlab sign function.

    Finally, don't forget to add the dot operator in front of theta.

    function main
    clc;clear;
    t=0:0.0001:(76*pi);
    x=((4619/60*sin(t+11/7)+109/8*sin(2*t+11/7)+9/7*sin(3*t+11/7)+89/15*sin(4*t+11/7)+5/11*sin(5*t+11/7)-9839/41).*theta(75*pi-t).*theta(t-71*pi)+(-179/8*sin(11/7-2*t)+2101/20*sin(t+11/7)+5/6*sin(3*t+23/5)+65/9*sin(4*t+33/7)+33/8*sin(5*t+8/5)-698/9).*theta(71*pi-t).*theta(t-67*pi)+(952/15*sin(t+11/7)+116/21*sin(2*t+19/12)+26/5*sin(3*t+11/7)+11/9*sin(4*t+11/7)+25/11*sin(5*t+11/7)+3071/10).*theta(67*pi-t).*theta(t-63*pi)+(-4/11*sin(17/11-4*t)+657/13*sin(t+33/7)+29/11*sin(2*t+47/10)+17/6*sin(3*t+14/9)+2/13*sin(5*t+22/13)+15/8*sin(6*t+33/7)+16/11*sin(7*t+47/10)+5/3*sin(8*t+47/10)+24/13*sin(9*t+33/7)+9/11*sin(10*t+47/10)+6/5*sin(11*t+47/10)+17/18*sin(12*t+47/10)+4/9*sin(13*t+75/16)+1163/3).*theta(63*pi-t).*theta(t-59*pi)+(-11/13*sin(11/7-6*t)-17/10*sin(11/7-4*t)+261/7*sin(t+11/7)+17/3*sin(2*t+33/7)+44/19*sin(3*t+11/7)+7/9*sin(5*t+14/9)+259/3).*theta(59*pi-t).*theta(t-55*pi)+(-9/11*sin(26/17-23*t)-287/9*sin(11/7-5*t)-271/9*sin(17/11-3*t)+1551/13*sin(t+17/11)+685/8*sin(2*t+17/11)+535/11*sin(4*t+14/9)+311/11*sin(6*t+14/9)+1141/60*sin(7*t+61/13)+19/9*sin(8*t+21/11)+55/8*sin(9*t+77/17)+239/12*sin(10*t+9/2)+7/9*sin(11*t+69/16)+59/6*sin(12*t+13/10)+73/24*sin(13*t+13/11)+17/12*sin(14*t+47/11)+11/16*sin(15*t+22/5)+17/6*sin(16*t+4/3)+7/11*sin(17*t+17/13)+17/9*sin(18*t+11/9)+7/4*sin(19*t+7/5)+5/4*sin(20*t+53/12)+50/13*sin(21*t+12/11)+103/13*sin(22*t+8/7)+13/5*sin(24*t+29/7)+1/2*sin(25*t+16/5)+31/16*sin(26*t+13/3)+8/7*sin(27*t+33/8)+17/14*sin(28*t+123/31)+22/9*sin(29*t+30/7)+2/3*sin(30*t+48/13)+19/12*sin(31*t+89/22)+18/11*sin(32*t+46/11)+417/8).*theta(55*pi-t).*theta(t-51*pi)+(-2/7*sin(14/9-10*t)-9/13*sin(14/9-8*t)-224/11*sin(11/7-3*t)+197/11*sin(t+11/7)+139/14*sin(2*t+11/7)+17/12*sin(4*t+47/10)+43/12*sin(5*t+33/7)+2/5*sin(6*t+47/10)+28/19*sin(7*t+47/10)+34/33*sin(9*t+47/10)+1/4*sin(11*t+14/3)+6/19*sin(12*t+19/12)-955/8).*theta(51*pi-t).*theta(t-47*pi)+(-149/28*sin(11/7-5*t)-65/6*sin(11/7-3*t)-641/12*sin(11/7-t)+265/9*sin(2*t+11/7)+37/5*sin(4*t+11/7)+7931/15).*theta(47*pi-t).*theta(t-43*pi)+(1810/9*sin(t+11/7)+1904/5*sin(2*t+11/7)+481/24*sin(3*t+61/13)+181/30*sin(4*t+11/7)+277/10*sin(5*t+19/12)+292/11*sin(6*t+19/12)+25/7*sin(7*t+47/10)+38/5*sin(8*t+8/5)+74/11*sin(9*t+8/5)+75/13*sin(10*t+8/5)+18/11*sin(11*t+19/12)+3109/13).*theta(43*pi-t).*theta(t-39*pi)+(-19/9*sin(11/7-12*t)-21/8*sin(11/7-10*t)-1/11*sin(17/11-8*t)-32/19*sin(14/9-6*t)+4137/22*sin(t+11/7)+177/14*sin(2*t+33/7)+173/14*sin(3*t+11/7)+3/2*sin(4*t+19/12)+5/8*sin(5*t+14/9)+21/8*sin(7*t+11/7)+19/10*sin(9*t+11/7)+41/15*sin(11*t+11/7)+2104/3).*theta(39*pi-t).*theta(t-35*pi)+(-5/6*sin(17/12-11*t)-7/15*sin(5/12-10*t)-32/13*sin(7/13-3*t)-139/7*sin(2/7-2*t)+2224/15*sin(t+9/10)+103/10*sin(4*t+23/5)+45/44*sin(5*t+7/3)+35/9*sin(6*t+23/8)+21/10*sin(7*t+25/11)+10/11*sin(8*t+4/5)+23/15*sin(9*t+5/7)+4/5*sin(12*t+9/2)+1339/11).*theta(35*pi-t).*theta(t-31*pi)+(1069/6*sin(t+18/13)+643/28*sin(2*t+11/7)+255/16*sin(3*t+11/15)+247/29*sin(4*t+45/13)+53/6*sin(5*t+9/11)+14/29*sin(6*t+31/7)+21/5*sin(7*t+19/7)+53/20*sin(8*t+3/14)+24/13*sin(9*t+24/11)+sin(10*t+27/14)+7/8*sin(11*t+11/9)+1/3*sin(12*t+7/4)+4512/25).*theta(31*pi-t).*theta(t-27*pi)+(-73/8*sin(1/9-11*t)-101/7*sin(7/8-3*t)+3221/13*sin(t+4/5)+389/8*sin(2*t+36/11)+368/11*sin(4*t+80/27)+107/4*sin(5*t+1/4)+29/2*sin(6*t+13/4)+237/19*sin(7*t+1/6)+263/17*sin(8*t+10/3)+79/9*sin(9*t+5/14)+68/9*sin(10*t+67/22)+43/5*sin(12*t+29/9)-3139/7).*theta(27*pi-t).*theta(t-23*pi)+(-7/9*sin(9/10-17*t)-22/13*sin(86/85-11*t)-43/10*sin(1/33-7*t)-64/7*sin(2/9-5*t)-19/10*sin(7/10-4*t)+2327/9*sin(t+19/5)+46*sin(2*t+7/4)+52/7*sin(3*t+31/9)+44/13*sin(6*t+17/11)+35/13*sin(8*t+23/8)+45/17*sin(9*t+9/2)+35/17*sin(10*t+34/9)+17/10*sin(12*t+17/8)+3/5*sin(13*t+41/10)+15/13*sin(14*t+41/14)+10/19*sin(15*t+139/35)+7/9*sin(16*t+24/11)+7/8*sin(18*t+3/5)+9/8*sin(19*t+6/7)+7/9*sin(20*t+25/14)+17/18*sin(21*t+7/11)+9/8*sin(22*t+22/15)+3/7*sin(23*t+11/4)+7/12*sin(24*t+26/9)+3/14*sin(25*t+26/7)+12/25*sin(26*t+62/25)+7/11*sin(27*t+64/15)+1/4*sin(28*t+95/24)+7/20*sin(29*t+3)+4/9*sin(30*t+14/5)+1/9*sin(31*t+4)+1/11*sin(32*t+9/11)+3/13*sin(33*t+8/5)+1/8*sin(34*t+20/11)+2/5*sin(35*t+2/7)-16257/22).*theta(23*pi-t).*theta(t-19*pi)+(-3/8*sin(2/7-5*t)-51/19*sin(1/28-3*t)-34/7*sin(3/8-2*t)+20/9*sin(t+155/52)+16/17*sin(4*t+25/7)+4/9*sin(6*t+24/7)+3/10*sin(7*t+3/7)+3/11*sin(8*t+41/11)+2/11*sin(9*t+9/19)+1/8*sin(10*t+389/97)+1/6*sin(11*t+2/7)+1/6*sin(12*t+47/16)+5910/19).*theta(19*pi-t).*theta(t-15*pi)+(-4/15*sin(12/23-7*t)+24/7*sin(t+21/8)+15/4*sin(2*t+3/2)+31/9*sin(3*t+7/5)+8/5*sin(4*t+25/7)+13/17*sin(5*t+1/4)+2/3*sin(6*t+46/15)+5/13*sin(8*t+3)+3/7*sin(9*t+2/5)+3/10*sin(10*t+53/15)+2/7*sin(11*t+2/5)+1/3*sin(12*t+25/7)+109/2).*theta(15*pi-t).*theta(t-11*pi)+(-53/14*sin(18/13-4*t)+592/7*sin(t+21/10)+107/27*sin(2*t+17/4)+29/13*sin(3*t+41/11)+859/12).*theta(11*pi-t).*theta(t-7*pi)+(287/3*sin(t+19/9)+16/5*sin(2*t+43/13)+57/10*sin(3*t+21/8)+33/17*sin(4*t+31/7)+1877/6).*theta(7*pi-t).*theta(t-3*pi)+(-5/8*sin(2/3-15*t)-17/8*sin(11/10-12*t)-11/6*sin(9/13-9*t)-507/10*sin(2/9-3*t)-69/13*sin(41/27-2*t)+1813/5*sin(t+11/3)+63/13*sin(4*t+25/8)+63/4*sin(5*t+23/5)+122/11*sin(6*t+49/16)+32/7*sin(7*t+19/9)+37/8*sin(8*t+12/7)+20/9*sin(10*t+17/8)+43/17*sin(11*t+1/69)+31/14*sin(13*t+21/5)+5/3*sin(14*t+32/11)+66/65*sin(16*t+53/14)+760/3).*theta(3*pi-t).*theta(t+pi)).*theta(sqrt(sign(sin(t/2))));
    y=((-13/5*sin(11/7-5*t)-51/8*sin(11/7-3*t)-28*sin(11/7-t)+97/6*sin(2*t+11/7)+124/25*sin(4*t+11/7)-7811/8).*theta(75*pi-t).*theta(t-71*pi)+(-76/7*sin(13/9-4*t)-69/4*sin(43/29-3*t)-50*sin(17/11-2*t)+229/12*sin(t+17/11)+13/8*sin(5*t+4/5)-2538/7).*theta(71*pi-t).*theta(t-67*pi)+(-17/4*sin(11/7-3*t)-217/11*sin(11/7-t)+79/7*sin(2*t+11/7)+11/6*sin(4*t+11/7)+15/14*sin(5*t+33/7)-79/6).*theta(67*pi-t).*theta(t-63*pi)+(-164/9*sin(11/7-2*t)+845/12*sin(t+11/7)+7/8*sin(3*t+18/11)+89/10*sin(4*t+33/7)+34/23*sin(5*t+47/10)+105/26*sin(6*t+33/7)+8/11*sin(7*t+14/9)+1/8*sin(8*t+17/11)+25/12*sin(9*t+11/7)+13/9*sin(10*t+11/7)+33/16*sin(11*t+14/9)+13/27*sin(12*t+14/9)+2/3*sin(13*t+14/9)+2671/13).*theta(63*pi-t).*theta(t-59*pi)+(-64/65*sin(14/9-6*t)-25/9*sin(14/9-5*t)-34/9*sin(14/9-4*t)-57/14*sin(14/9-3*t)-19/14*sin(11/7-2*t)+21/2*sin(t+11/7)+3133/11).*theta(59*pi-t).*theta(t-55*pi)+(-25/24*sin(23/15-27*t)-5/14*sin(14/11-25*t)-2/3*sin(16/11-17*t)-55/9*sin(40/27-8*t)-352/13*sin(14/9-5*t)-1519/38*sin(14/9-3*t)+3329/32*sin(t+47/10)+297/4*sin(2*t+14/9)+1939/38*sin(4*t+14/9)+239/9*sin(6*t+32/21)+34/9*sin(7*t+19/15)+107/6*sin(9*t+10/7)+271/10*sin(10*t+40/9)+693/13*sin(11*t+86/19)+160/7*sin(12*t+13/9)+289/16*sin(13*t+7/6)+385/48*sin(14*t+9/7)+44/9*sin(15*t+5/4)+41/11*sin(16*t+13/10)+12/13*sin(18*t+12/5)+46/9*sin(19*t+40/9)+10/9*sin(20*t+38/25)+46/31*sin(21*t+75/16)+37/16*sin(22*t+41/10)+35/11*sin(23*t+43/10)+10/13*sin(24*t+63/16)+2/3*sin(26*t+47/13)+19/7*sin(28*t+6/5)+13/10*sin(29*t+59/13)+3/2*sin(30*t+4/3)+11/10*sin(31*t+5/7)+17/13*sin(32*t+15/4)-11101/75).*theta(55*pi-t).*theta(t-51*pi)+(-3/10*sin(14/9-12*t)-29/12*sin(11/7-6*t)-38/9*sin(11/7-4*t)-59/8*sin(11/7-t)+183/7*sin(2*t+11/7)+125/13*sin(3*t+11/7)+31/16*sin(5*t+19/12)+4/9*sin(7*t+11/7)+3/13*sin(8*t+47/10)+64/63*sin(9*t+14/9)+3/13*sin(10*t+33/7)+1/2*sin(11*t+19/12)-11360/13).*theta(51*pi-t).*theta(t-47*pi)+(-60/11*sin(11/7-4*t)-528/31*sin(11/7-3*t)-661/55*sin(11/7-2*t)-623/3*sin(11/7-t)+39/8*sin(5*t+33/7)-5871/8).*theta(47*pi-t).*theta(t-43*pi)+(-43/13*sin(14/9-11*t)-45/8*sin(11/7-9*t)-41/15*sin(14/9-8*t)-57/11*sin(14/9-7*t)-157/6*sin(11/7-5*t)-1813/6*sin(11/7-t)+1997/15*sin(2*t+11/7)+89/6*sin(3*t+47/10)+19/6*sin(4*t+23/15)+191/8*sin(6*t+11/7)+191/17*sin(10*t+19/12)-7307/9).*theta(43*pi-t).*theta(t-39*pi)+(-15/8*sin(11/7-12*t)-72/73*sin(14/9-11*t)-19/9*sin(11/7-10*t)-35/11*sin(11/7-9*t)-7/11*sin(14/9-8*t)-60/11*sin(11/7-7*t)-191/13*sin(11/7-5*t)-184/5*sin(11/7-3*t)-109/10*sin(11/7-2*t)-609/2*sin(11/7-t)+1/6*sin(4*t+5/4)+11/5*sin(6*t+47/10)-6582/11).*theta(39*pi-t).*theta(t-35*pi)+(-11/15*sin(6/7-9*t)-47/13*sin(26/25-5*t)-67/27*sin(13/12-4*t)-633/8*sin(3/10-t)+251/7*sin(2*t+9/8)+123/8*sin(3*t+64/15)+23/8*sin(6*t+22/13)+26/9*sin(7*t+23/6)+14/9*sin(8*t+3/5)+19/12*sin(10*t+9/7)+25/19*sin(11*t+13/3)+11/17*sin(12*t+7/12)-5757/11).*theta(35*pi-t).*theta(t-31*pi)+(-50/3*sin(3/4-3*t)+263/10*sin(t+83/28)+669/13*sin(2*t+11/5)+17*sin(4*t+13/7)+67/11*sin(5*t+19/8)+11/3*sin(6*t+1/12)+38/17*sin(7*t+9/5)+51/14*sin(8*t+5/3)+49/25*sin(9*t+41/10)+17/12*sin(10*t+7/12)+53/54*sin(11*t+24/7)+5/7*sin(12*t+7/4)-10661/26).*theta(31*pi-t).*theta(t-27*pi)+(-127/10*sin(16/17-7*t)-119/9*sin(11/9-5*t)-1191/4*sin(1/3-t)+735/11*sin(2*t+2/9)+287/8*sin(3*t+61/16)+504/19*sin(4*t+17/9)+73/9*sin(6*t+9/5)+62/7*sin(8*t+14/5)+32/5*sin(9*t+1/6)+7/2*sin(10*t+19/7)+19/7*sin(11*t+1/44)+167/56*sin(12*t+51/14)-12878/17).*theta(27*pi-t).*theta(t-23*pi)+(-5/12*sin(14/15-32*t)-1/18*sin(17/13-31*t)-23/11*sin(1/6-19*t)-11/9*sin(38/25-18*t)-243/61*sin(25/17-8*t)-35/9*sin(11/21-7*t)-87/7*sin(4/5-6*t)-2249/15*sin(1/10-2*t)+1997/10*sin(t+23/12)+725/13*sin(3*t+1)+67/8*sin(4*t+9/4)+216/11*sin(5*t+23/5)+18/11*sin(9*t+32/31)+48/13*sin(10*t+19/8)+211/35*sin(11*t+16/5)+36/13*sin(12*t+64/15)+30/29*sin(13*t+8/13)+20/11*sin(14*t+28/13)+11/17*sin(15*t+37/16)+5/8*sin(16*t+23/14)+4/7*sin(17*t+14/9)+91/45*sin(20*t+14/27)+47/31*sin(21*t+8/5)+6/7*sin(22*t+29/15)+8/9*sin(23*t+53/20)+13/10*sin(24*t+89/30)+8/9*sin(25*t+39/10)+7/20*sin(26*t+97/24)+4/9*sin(27*t+18/13)+7/8*sin(28*t+45/14)+2/7*sin(29*t+42/13)+3/11*sin(30*t+22/5)+8/17*sin(33*t+4/11)+5/9*sin(34*t+18/13)+3/14*sin(35*t+12/5)-3384/11).*theta(23*pi-t).*theta(t-19*pi)+(-1/38*sin(2/11-7*t)-35/11*sin(9/14-t)+341/85*sin(2*t+25/14)+34/11*sin(3*t+22/21)+42/43*sin(4*t+223/56)+14/15*sin(5*t+3/4)+12/23*sin(6*t+7/2)+1/7*sin(8*t+4)+2/11*sin(9*t+9/8)+2/11*sin(10*t+73/29)+1/7*sin(11*t+1/4)+2/11*sin(12*t+74/25)+2961/20).*theta(19*pi-t).*theta(t-15*pi)+(-3/11*sin(13/25-12*t)-1/3*sin(15/29-10*t)-1/9*sin(4/3-8*t)-16/9*sin(12/13-4*t)+35/18*sin(t+89/19)+33/8*sin(2*t+49/16)+43/14*sin(3*t+33/13)+3/10*sin(5*t+26/11)+3/10*sin(6*t+4/11)+9/17*sin(7*t+94/27)+1/5*sin(9*t+35/11)+1/4*sin(11*t+20/7)+2917/15).*theta(15*pi-t).*theta(t-11*pi)+(949/15*sin(t+11/3)+63/11*sin(2*t+19/9)+26/7*sin(3*t+22/5)+7/8*sin(4*t+28/13)+3715/23).*theta(11*pi-t).*theta(t-7*pi)+(658/9*sin(t+107/27)+57/10*sin(2*t+9/5)+56/13*sin(3*t+38/9)+7/6*sin(4*t+10/11)+1681/16).*theta(7*pi-t).*theta(t-3*pi)+(-9/11*sin(13/10-16*t)-14/15*sin(2/7-15*t)-12/7*sin(3/8-12*t)-29/6*sin(5/11-8*t)-80/9*sin(5/14-4*t)+3076/7*sin(t+12/5)+343/18*sin(2*t+13/3)+230/17*sin(3*t+31/8)+21/4*sin(5*t+53/21)+23/10*sin(6*t+1/5)+27/7*sin(7*t+5/12)+60/17*sin(9*t+38/9)+11/8*sin(10*t+49/16)+10/7*sin(11*t+2/3)+4/7*sin(13*t+18/5)+17/12*sin(14*t+9/7)+598/9).*theta(3*pi-t).*theta(t+pi)).*theta(sqrt(sign(sin(t/2))));
    
    plot(x,y,'.');
    end
    
    % function result=sign(in)
    % 
    % if in<0
    %     result=-1;
    % else
    %     result=1;
    % end
    % 
    % end
    
    function result=theta(in)
    
    result = (in>0);
    end
    

    enter image description here

    Edit: use dot in the plot function to remove ugly lines

    0 讨论(0)
提交回复
热议问题