home *** CD-ROM | disk | FTP | other *** search
- /* Illustration of logarithmic axes, and redefinition of window */
-
- #include <math.h>
-
- main()
- {
- int i;
- float freql[101],ampl[101],phase[101];
- float f0, freq;
-
- plstar(1,1);
- pladv(0);
- plfont(2);
-
- f0 = 1000.0;
- for (i=0; i<=100; i++) {
- freql[i]=1.0+i/20.0;
- freq= pow(10.0,freql[i]);
- ampl[i]=20.0*log10(1.0/sqrt(1.0+pow((freq/f0),2.)));
- phase[i]=-(180.0/3.141592654)*atan(freq/f0);
- }
-
- plvpor(0.15,0.85,0.1,0.9);
- plwind(1.0,6.0,-80.0,0.0);
- plbox("bclnst",0.0,0,"bnstv",0.0,0);
- plline(101,freql,ampl);
- plptex(5.0,-30.0,1.0,-20.0,0.5,"-20 dB/decade");
- plwind(1.0,6.0,-100.0,0.0);
- plbox(" ",0.0,0,"cmstv",30.0,3);
- plline(101,freql,phase);
-
- plmtex("b",3.2,0.5,0.5,"Frequency");
- plmtex("t",2.0,0.5,0.5,"Single Pole Low-Pass Filter");
- plmtex("l",5.0,0.5,0.5,"Amplitude (dB)");
- plmtex("r",5.0,0.5,0.5,"Phase shift (degrees)");
-
- plend();
- }
-