Dente di sega di fase

ClearAll[a];
dimimm=200;
nmax2=10;
ordinemax2=3;
fase2= 2 Pi a x;
tau2=Exp[I fase2];
(*
tau2n=Table[{n,Abs[Integrate[tau2 Exp[I 2 Pi n x],{x,0,1}]]},{n,-nmax,nmax}];
*)
tau2n=Table[{n,Sin[Pi (n-a)]/(Pi( n-a))},{n,-nmax2,nmax2}];
Manipulate[
Column[{
Plot[fase2/. {a->aval},{x,0,1},PlotRange->{0,2 Pi ordinemax2},ImageSize->dimimm],
Show[
ListPlot[tau2n/. {a->aval},PlotStyle->{PointSize[Large]},PlotRange->{-.2,1.1},ImageSize->dimimm,Filling->Axis],
Plot[Sin[Pi ( x-a)]/Pi/( x-a)/. {a->aval},{x,-nmax2,nmax2},PlotRange->{-.2,1.1},PlotStyle->{Red, Dashed}]
]
}]
,{{aval,-.001,"a"},-.001,ordinemax2-.001,.1}]

Reticolo rettangolare di ampiezza

dimimm=200;
tau3=Piecewise[{{1,x<=x0},{0,x>x0}}];
Manipulate[
Column[{
DensityPlot[tau3/. {x0->x0val},{x,0,1},{y,0,1},PlotPoints->100,ImageSize->dimimm,ColorFunction->GrayLevel],
Plot[tau3/. {x0->x0val},{x,0,1},PlotRange->{-.1,1},ImageSize->dimimm],
}]
,{{x0val,.5,"x0"},0,1,.1}]

modulo dei coefficienti

ClearAll[x0];
dimimm=200;
nmax4=10;
tau4=Piecewise[{{1,x<x0},{0,x>x0}}];
(*
tau4n=Table[{n,Abs[Integrate[tau4 Exp[I 2 Pi n x],{x,0,1}]]},{n,-nmax,nmax}];
*)
tau4n=Table[{n,x0 Abs[Sinc[Pi x0 n]]},{n,-nmax4,nmax4}];
tau4n[[nmax+1]]={0,x0};
Manipulate[
Column[{
Plot[tau4/. {x0->x0val},{x,0,1},PlotRange->{-.1,1},ImageSize->dimimm],
Show[
ListPlot[tau4n/. {x0->x0val},PlotStyle->{PointSize[Large]},PlotRange->{-.1,1.},ImageSize->dimimm,Filling->Axis],
Plot[x0 Abs[Sinc[Pi x0 x]]/. {x0->x0val},{x,-nmax4,nmax4},PlotRange->{-.1,1.},PlotStyle->{Red, Dashed}]
]
}]
,{{x0val,1,"x0"},0.0001,1.0001,1/20}]

Reticolo rettangolare di fase (modulo dei coeff.)

ClearAll[x0];
dimimm=200;
nmax5=10;
fase5=Piecewise[{{fi0,x<x0},{0,x>x0}}];
tau5=Exp[I fase5];

(*
tau5n=Table[{n,Abs[Integrate[tau4 Exp[I 2 Pi n x],{x,0,1}]]},{n,-nmax,nmax}];
*)
tau5n=Table[{n,Abs[x0 Sinc[Pi n x0] (1-Exp[I fi0])]},{n,-nmax5,nmax5}];
tau5n[[nmax5+1]]={0,Abs[x0 +(1-x0)Exp[I fi0]]};
eff=Abs[tau5n[[nmax5+1]]]^2+Abs[tau5n[[nmax5+2]]]^2+Abs[tau5n[[nmax5]]]^2 ; (* somma delle potenze dei tre ordini centrali*)
Manipulate[
Column[{
Plot[fase5/. {x0->x0val,fi0->fi0val},{x,0,1},PlotRange->{-.1,2Pi},ImageSize->dimimm],
eff[[2]]/. {x0->x0val,fi0->fi0val},
Show[
ListPlot[tau5n/. {x0->x0val,fi0->fi0val},PlotStyle->{PointSize[Large]},PlotRange->{-.1,1.},ImageSize->dimimm,Filling->Axis],
Plot[(2 x0 Sin[fi0/2] Abs[Sinc[Pi x0 x]])/. {x0->x0val,fi0->fi0val},{x,-nmax5,nmax5},PlotRange->{-.1,1.},PlotStyle->{Red, Dashed}]
]
}]
,{{x0val,.1,"x0"},0.0,1.0,1/40},{{fi0val,0.0078,"fi0"},0.0078,2 Pi,0.01}]

Reticolo rettangolare di fase (modulo quadro dei coeff.)

ClearAll[x0];
dimimm=200;
nmax7=10;
fase7=Piecewise[{{fi0,x<x0},{0,x>x0}}];
tau7=Exp[I fase7];

(*
tau7n=Table[{n,Abs[Integrate[tau7 Exp[I 2 Pi n x],{x,0,1}]]},{n,-nmax,nmax}];
*)
tau7n=Table[{n,Abs[x0 Sinc[Pi n x0] (1-Exp[I fi0])]^2},{n,-nmax7,nmax7}];
tau7n[[nmax7+1]]={0,Abs[x0 +(1-x0)Exp[I fi0]]^2};
Manipulate[
Column[{
Plot[fase7/. {x0->x0val,fi0->fi0val},{x,0,1},PlotRange->{-.1,2Pi},ImageSize->dimimm],
Show[
ListPlot[tau7n/. {x0->x0val,fi0->fi0val},PlotStyle->{PointSize[Large]},PlotRange->{-.1,1.},ImageSize->dimimm,Filling->Axis],
Plot[(2 x0 Sin[fi0/2] Abs[Sinc[Pi x0 x]])^2/. {x0->x0val,fi0->fi0val},{x,-nmax7,nmax7},PlotRange->{-.1,1.},PlotStyle->{Red, Dashed}]
]
}]
,{{x0val,.1,"x0"},0.00001,1.0,1/40},{{fi0val,0.0078,"fi0"},0.0078,2 Pi,0.01}]

Reticolo di fase sinusoidale (modulo dei coeff)

ClearAll[a];
dimimm=200;
nmax6=10;
fasemax6=Pi;
fase6= a Sin[2 Pi x];
tau6=Exp[I fase6];
(*
tau6n=Table[{n,Abs[Integrate[tau6 Exp[I 2 Pi n x],{x,0,1}]]},{n,-nmax,nmax}];
*)
tau6n=Table[{n, Abs[BesselJ[n,a]]},{n,-nmax6,nmax6}];
eff6=Abs[tau6n[[nmax6+1]]]^2+Abs[tau6n[[nmax6+2]]]^2+Abs[tau6n[[nmax6]]]^2 ;  (* somma delle potenze dei tre ordini centrali*)

Manipulate[
Column[{
Plot[fase6/. {a->aval},{x,0,1},PlotRange->{-fasemax6,fasemax6},ImageSize->dimimm],
eff6[[2]]/.  {a->aval},
Show[
ListPlot[tau6n/. {a->aval},PlotStyle->{PointSize[Large]},PlotRange->{0,1.1},ImageSize->dimimm,Filling->Axis],
Plot[Abs[BesselJ[Abs[x],a]]/. {a->aval},{x,-nmax6,nmax6},PlotRange->{0,1.1},PlotStyle->{Red, Dashed}]
]
}]
,{{aval,-.001,"a"},-.001,fasemax6-.0005,.01}]

dimimm=200;
Manipulate[
Column[{
BesselJ[0,xval],
BesselJ[1,xval],
Show[
Plot[BesselJ[1,x],{x,0,2.5},PlotRange->{0,1},ImageSize->dimimm,Epilog->{PointSize[Medium],Point[{{xval,BesselJ[1,xval]},{xval,BesselJ[0,xval]}}]}],
Plot[BesselJ[0,x],{x,0,2.5},PlotRange->{0,1},ImageSize->dimimm,PlotStyle->Red]
]}]
,{{xval,0,"x"},0,2.5,0.001}]
FindRoot[BesselJ[0,x]-BesselJ[1,x],{x,1}]

Reticolo di fase sinusoidale (modulo quadro dei coeff)

ClearAll[a];
dimimm=200;
nmax8=10;
fasemax8=2Pi;
fase8= a Sin[2 Pi x];
tau8=Exp[I fase8];
(*
tau8n=Table[{n,Abs[Integrate[tau8 Exp[I 2 Pi n x],{x,0,1}]]},{n,-nmax8,nmax8}];
*)
tau8n=Table[{n, BesselJ[Abs[n],a]^2},{n,-nmax8,nmax8}];
eff8=Abs[tau8n[[nmax8+1]]]+Abs[tau8n[[nmax8+2]]]+Abs[tau8n[[nmax8]]] ;  (* somma delle potenze dei tre ordini centrali*)

Manipulate[
Column[{
Plot[fase8/. {a->aval},{x,0,1},PlotRange->{-fasemax8,fasemax8},ImageSize->dimimm],
eff8[[2]]/.  {a->aval},
Show[
ListPlot[tau8n/. {a->aval},PlotStyle->{PointSize[Large]},PlotRange->{-.1,1.1},ImageSize->dimimm,Filling->Axis],
Plot[BesselJ[Abs[x],a]^2/. {a->aval},{x,-nmax8,nmax8},PlotRange->{-.1,1.1},PlotStyle->{Red, Dashed}]
]
}]
,{{aval,.035,"a"},.035,fasemax8,.025}]

Triplicatore ottimo (modulo dei coeff.)

ClearAll[x0,fi0];
dimimm=250;
nmax9=1; (* deve essere = 1 *)
fase9=ArcTan[fi0 Sin[2 Pi x]];
tau9=Exp[I fase9];

(*
tau9n=Table[{n,Abs[Integrate[tau9 Exp[I 2 Pi n x],{x,0,1}]]},{n,-nmax9,nmax9}];

Manipulate[
Column[{
Plot[fase9/. {fi0->fi0val},{x,0,1},PlotRange->{-Pi,Pi},ImageSize->dimimm],
ListPlot[tau9n/. {fi0->fi0val},PlotStyle->{PointSize[Large]},PlotRange->{-.1,1.},ImageSize->dimimm,Filling->Axis]
}]
,{{fi0val,0.0078,"fi0"},0.0078,2 Pi,0.01}]
*)

abstau9n={{-1,(2/Pi)(EllipticE[-fi0^2]-EllipticK[-fi0^2])/fi0},(2/Pi){0,EllipticK[-fi0^2]}, {1,(2/Pi)(EllipticE[-fi0^2]-EllipticK[-fi0^2])/fi0}};
eff9=Sum[abstau9n[[n,2]]^2,{n,1,3}];
Manipulate[
Column[{
Plot[fase9/. {fi0->fi0val},{x,0,1},PlotRange->{-Pi/2,Pi/2},ImageSize->dimimm],
eff9 /.{fi0->fi0val},
Show[
ListPlot[abstau9n/. {fi0->fi0val},PlotStyle->{PointSize[Large]},PlotRange->{-.1,1.},ImageSize->dimimm,Filling->Axis],
Plot[abstau9n[[1,2]]/. {fi0->fi0val},{x,-1,1},PlotRange->{0,1},ImageSize->dimimm,PlotStyle->{Red, Dashed}],
Plot[abstau9n[[2,2]]/. {fi0->fi0val},{x,-1,1},PlotRange->{0,1},ImageSize->dimimm,PlotStyle->{Blue, Dashed}]
]
}]
,{{fi0val,0.0078,"fi0"},0.0078,2 Pi,0.01}]

Dente di sega discretizzato

ClearAll[enne];

sinsusin[x_,n_]:=If[x/n ∈Integers,n,Sin[Pi x]/ Sin[Pi x/n]];
sinc[x_]:=Sinc[Pi x];

dimimm=200;
nmax10=20;

(* fasi=Piecewise[Table[{2 Pi/enne (s-1/2),x>=(s-1)/enne && x<s/enne},{s,1,enne}]]; *)
(* tau5n=Table[{n,sinc[n/enne] sinsusin[(n-1),enne]/enne},{n,0,nmax}]; *)

Manipulate[
Column[{
Plot[{Piecewise[Table[{2 Pi/enne (s-1/2),x>=(s-1)/enne && x<=s/enne},{s,1,enne}]],2 Pi x},{x,0,1},PlotRange->{0,2Pi},ImageSize->dimimm],
ListPlot[tau5n=Table[{n,sinc[n/enne] sinsusin[(n-1),enne]/enne},{n,0,nmax10}],PlotStyle->{PointSize[Large]},PlotRange->{-.3,1.1},ImageSize->dimimm,Filling->Axis],
tau5n[[2,2]]^2 //N
}]
,{{enne,1,"N"},1,nmax10,1}]

Triplicatore di Dammann

dimimm=200;
Manipulate[
Column[{
(1-2 xval)^2,
(2 Sin[Pi xval]/Pi)^2,
Show[
Plot[(1-2 x)^2,{x,0,1},PlotRange->{0,1},ImageSize->dimimm,Epilog->{PointSize[Medium],Point[{{xval,(1-2 xval)^2},{xval,(2 Sin[Pi xval]/Pi)^2}}]}],
Plot[(2 Sin[Pi x]/Pi)^2,{x,0,1},PlotRange->{0,1},ImageSize->dimimm,PlotStyle->Red]
]}]
,{{xval,0,"x"},0,2.5,0.001}]
FindRoot[(1-2 x)^2-(2 Sin[Pi x]/Pi)^2,{x,0}]
FindRoot[(1-2 x)^2-(2 Sin[Pi x]/Pi)^2,{x,1}]