the code is based on Statistics_1Var_Copy (newer firmware)
it works but buggy using Symb>>Dot....this is my code.
execute START from VIEW. Q: I assume this will be to show the Info screen on completion? Yes and also reset App.
BODE(-1,1,[1],[1 0.2 1]) on the home screen. Yes
Home screen >>VIEW>>Magnitude>>Plot (to see bode) use Zoom from soft menu
Code:
Tf();
BODE();
Xmin=0,Xmax=0;
VIEW "Start/Info",START()
BEGIN
D1:={};
D2:={};
SetSample(H1,D1);
SetFreq(H1,D2);
H1(3):=8;
STARTVIEW(6,1);
WAIT();
STARTVIEW(-1,1);
END;
export BODE(Xmin,Xmax,num,den)
BEGIN
Statistics_1Var_Copy.Xmin:=Xmin;
Statistics_1Var_Copy.Xmax:=Xmax;
local num:=poly2symb(num,"*x");
local den:=poly2symb(den,"*x");
expand(num/den)▶F1;
Xtick:=0.01;
makelist(ALOG(X),X,Xmin,Xmax,Xtick)▶L1;
L2:=Tf(L1);
L7:=20*LOG(ABS(L2));
L3:=ARG(L2)*180/pi;
L4:=IM(L2);
L5:=RE(L2);
END;
EXPORT Tf(x)
BEGIN
L2:=(F1(X)|x=L1);
END;
VIEW "Nyquist",nyquist()
BEGIN
L5▶D2;
L4▶D1;
Xmin:= FLOOR(MIN(D1)+1);
Xmax:= CEILING(MAX(D1)+1);
Ymin:= FLOOR(MIN(D2)+1);
Ymax:= CEILING(MAX(D2)+1);
END;
VIEW "Magnitude",Magnitude()
BEGIN
D1:=L1;
D2:=L7;
Xmin:= Statistics_1Var_Copy.Xmin;
Xmax:= Statistics_1Var_Copy.Xmax;
Ymin:= FLOOR(MIN(D2)+1);
Ymax:= CEILING(MAX(D2)+1);
END;
VIEW "Phase",Phase()
BEGIN
D1:=L1;
D2:=L3;
Xmin:= Statistics_1Var_Copy.Xmin;
Xmax:= Statistics_1Var_Copy.Xmax;
Ymin:= FLOOR(MIN(D2)+1);
Ymax:= CEILING(MAX(D2)+1);
END;
PLOT()
BEGIN
Xmin:= Statistics_1Var_Copy.Xmin;
Xmax:= Statistics_1Var_Copy.Xmax;
Ymin:= FLOOR(MIN(D2)+1);
Ymax:= CEILING(MAX(D2)+1);
STARTVIEW(1,1);
END;