>load util;load electricity
% spectrum of a 100 Hz square wave signal. Extra parameters f and 5
% needed by sqrwave can be passed added to the list of parameters of
% plotFFT.
>f=100;T=1/f;plotFFT("sqrwave",10*T,256,f,5);
% spectrum of a 1 kHz sinusoidal signal 1 kHz modulated by a 10 kHz carrier.
% plotFFT returns the sampling frequency.
>f1=10e3;f2=1e3;plotFFT("5*sin(2*pi*f1*x)*(1+0.5*sin(2*pi*f2*x))",10/f2)
% a bode diagram
>bode("1/(1+j*x)",0.1,10);title("low pass filter");
% a plot to simulate an oscilloscope (autorange)
>f=100;T=1/f;t=0:T/100:T;v1=5*sin(2*pi*f*t);v2=12*sin(2*pi*f*t-pi/3);
>shrinkwindow();scope(t,v1,v2);
% even in XY...
>scope(,v1,v2);
>
