File: electricity.en

package info (click to toggle)
euler 1.61.0-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 5,164 kB
  • sloc: ansic: 24,761; sh: 8,314; makefile: 141; cpp: 47; php: 1
file content (16 lines) | stat: -rw-r--r-- 668 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
>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);
>