======================ANALOG_SIGNAL========================= NEW FEATURES These are my personal cheatsheets designed to make access to detailed information much easier to find. In addition, some cut and paste code is being added to do the following. Calculate 3dB ---------Cut_and_Paste_Into_Formula Calculator-------------- Frequency_Hz=1/(2*3.14*R*C) R=1e3 =Resistance_Ohms C=1e-6=Capacitance_Farad ----------------------------------------------------------- Formula Calculator http://www.idea2ic.com/PlayWithJavascript/Formula_calculator.html Plot a graph ---------Cut_and_Paste_Into_A_SciLab_Window-------------- x = linspace(-10, 10, 5) // x = - 10. - 5. 0. 5. 10. x = linspace(-10, 10, 1000); // x from -10 to 10 in 1000 steps y = 2*sin(x) + 3*sin(2*x) ; plot2d(x,y) // x y plot ----------------------------------------------------------- SCILAB_Templates http://www.idea2ic.com/PlayWithFink/scilab_Picture/SCILAB%20Templates.html Don Sauer 10/17/09 dsauersanjose@aol.com -------------------------------------------------------------------------------------- impedance C _|_ Z(S) = 1/s*C ___ | _ _ _ /*\/ \/ \ Z(S) = s*L ___ | () () | ___ impedance L | |__| |__| | |___| |___| -------------------------------------------------------------------------------------- L Z(S) =s*L _ _ _ __ R / \/ \/ \ ___ |IN|_ /\_| () () |______|OUT| |__| \/ | |___| _|_ ___ C Z(S)= 1/s*C __ | __ | |_________________|____| | |__| |__| Transfer Function OUT = IN*( 1/s*C)/( R + s*L +1/s*C ) OUT = IN*1/(a*s^2 +b*s +c ) Calc LC Freq ---------Cut_and_Paste_Into_Formula Calculator-------------- Frequency_Hz = 1/(2*PI*pow(L*C,0.5)) C=1=Capacitance_Farad L=1=Inductance_Henry Calc RC Freq ---------Cut_and_Paste_Into_Formula Calculator-------------- Frequency_Hz=1/(2*PI*R*C) R=1e3=Resistance_Ohms C=1e-6=Capacitance_Farad Calc dB ---------Cut_and_Paste_Into_Formula Calculator-------------- dB=20*log(V1/V2)/LN10 V1=10=value_1 V2=1=value_2 -------------------------------------------------------------------------------------- Complex_Poles 1/(a*s^2 +b*s +c) = 1/(s^2 +(wo/Q)*s +wo^2) Quadratic formula a*x^2 +b*x +c = 0 roots (-b +/-sqrt(b^2-4ac))/2a 1/(a*s^2 +b*s +c) =1/(( s +alpha +jwo )*( s +alpha -jwo )) IMAGINARY ^ /|\ | X | ^ | | jw0 ______|_v_____\ REAL | / | X | <-> alpha -------------------------------------------------------------------------------------- Q_factor QualityFactor cycles to settle ( Impedance_L )/R cycles to settle ring freq where Impedance_L = Impedance_C 2*PI()*Freq*L equals 1/(2*PI()*Freq*C) _ | | _ | | | | _ | | | | | | _ PULSE RESPONSE | | | | | | | | _ | | | | | | | | | | _ |_|_|_|_|_|_|_|_|_|_|_|_____\ | | | | | | | | | |_| / Time | | | | | | | |_| | | | | | |_| | | | |_| | | | | |_| LowPass Q = 10 20dB|................................................ | . . . . | . b Q=10 . . | . . . . | . b . . . | . b .b . . 0dB|..........a..a...a.............................. | . a . b . . | . . . . | . a b . . | . . a . . | . . a . . -20dB|.............................a.................. | . . . | . . . . | . . . . | . . . . | . . . . |______________________________________________ . 100KHz 1MHz 10MHz 100MHz 1GHz -------------------------------------------------------------------------------------- on imaginary axes When poles are exactly on the imaginary axis it says you will have a constant sine wave at frequency 2*pi*w IMAGINARY ^ /|\ PULSE RESPONSE | _ _ _ X | | | | | | ______|____\ REAL |_|_|_|_|_|_____\ | / | | | | | | / Time X | |_| |_| | Normal poles When poles are slightly in the left half plane it says you will have a sine wave at frequency 2*pi*w which is decaying at the a rate defined the dsitance from the axis. ^ /|\ _ | | | _ PULSE RESPONSE X | | | | | _ ______|____\ REAL |_|_|_|_|_|_____\ | / | | | |_| / Time X | | |_| IMAGINARY Left Half Plane When poles are in left half plane you will have a decay at the a rate defined the dsitance from the axis. IMAGINARY ^ /|\ _ PULSE RESPONSE | - _ | - _ ___X__|____\ REAL ________________\ | / / Time | Right Half Plane When poles are in Right half plane you are unstable IMAGINARY ^ /|\ PULSE RESPONSE | _ - | _ - ______|_X__\ REAL ________________\ | / / Time | IMAGINARY IMAGINARY ^ /|\ _ PULSE RESPONSE | _ | | | X _ | | | | _______|____\ REAL |_|_|_|_|_|_____\ | / | |_| | | | / Time | X |_| | -------------------------------------------------------------------------------------- Describing Function the following basic assumptions. A) input to nonlinear element n is sinusoidal only the fundamental component of output of n. contributes to the input. The output response of nonlinear element consists of the fundamental frequency and harmonics Generally, harmonic smaller than fundamental most control systems the system a low-pass filter and the higher harmonics are attenuated. If harmonics small can be neglected B) All nonlinearities lumped into one single nonlinear element n C) output of nonlinear element is a function only of the present value and past history of the input, i D) n is not a function of time. The describing function of a nonlinear element __ + / \ e ____ ____ ___\__/ \/ \__\__| n |___\__| G |________\ C r / \ /\ / / |____| / |____| | / \__/ | - ^ | |______________________________| diagram of nonlinear closed-loop system. -------------------------------------------------------------------------------------- Limit Cycle oscillation of nonlinear systems characterized by a constant am1diiude and frequency determined by the nonlinear properties of system. output approaching the amplitude of that limit cycle regardless of initial condition and forcing function. Hewlet Packard used a lightbulb to define the amplitude of their oscilator. As the amplitude of the output got larger, it would lower in resistance and such that the positive feedback was exactly one. _ | _\| /| __-->|--__ / _ | \ | / /| | _\| \ V _____|______|______|______ ^ | _ | | | | \ |\ | |/_ / V \ | / <--__|_<-- |/_ -------------------------------------------------------------------------------------- nonlinear system output of nonlinear device contains harmonic and subbarmonic frequencies (except for HPÍs oscillator) soft self-excitation limit cycle in very small excitation or disturbances. hard self-excitation requiring forced excitation above a certain minimum amplitude o Undervoltage Lockout Hysteresis Switcher on _|_ _____________________ | | <-- | | | | ^ | | | v --> | | Switcher off |_____|_______________|______\ Input Voltage V(turn off) V(turn on) / DeltaV V(turn on) No load voltage from transfomer @ lO8Vac V(turn off) Full load voltage from transformer @ lO5Vac Delta_V V(turn on) - V(turn off) ; Hysteresis using undervotage circuit with hysteresis, we can prevent the power supply from oscillating on and off. V(turn on) the no load voltage from the transformer. This is very close to 108*sqrt(2)*Ns/Np V(turn off) the full load voltage from the transformer at IO5Vac. This value is sensitive to load conditions for each design, and should be measured on the bench during design. delta_V the difference between these two voltages, is value use for the undervoltage lockout hysteresis. Hysteresis Multivalued functions exist when two or moore function values correspond to the value of the variable. hysteresis curves of magnetic materials and the backlash of a gear train. -------------------------------------------------------------------------------------- CONDITIONALY STABLE GAIN_PHASE CONDITIONALY STABLE can only oscilate by changing loop gain during start up,sat.lower VCC .. delicate 60dB |................................................ | P . . . . | P . . . . |G G G <== Open Loop Gain . . | P G . . . . | P G . . . . 40dB|........P..G.P..................................90 | . G . . . | . G . . . | . G P . . . | . G . . . | . G . . . 20dB |....................P..G.........P..............45 | . . G P P . | . . G .P 38deg . | . P. GP . P Phase . | . . G . P Margin . | . .P P G . P . 0dB |0000000000000000000000000000P000000V0000P0000000 0 | . . P . G ^ Gain . | . . . G| Margin | . . . V . | . . . G . | . . . . -20dB|______________________________________________ . 10KHz 100KHz 1MHz 10MHz 100MHz -------------------------------------------------------------------------------------- exp(j*X) = cos(x) +j*sin(x) -------------------------------------------------------------------------------------- Jump Resonance Amplitude | f | |\ | | \d | g| |\ |_____|/ \e | a b c \ | |_____________ freq -> Amplitude | |_a__b___ | |g \ | f|___\c | \ | \_______ | d e |_____________ freq -> -------------------------------------------------------------------------------------- Maxwell's Equations __ \/ dot J = -delta_p/dt __ \/ cross E = -delta_B/dt V=delta_Phi/dt __ \/ cross H = J+ delta_D/dt H =I*N __ \/ dot D = p __ \/ dot B = 0 -------------------------------------------------------------------------------------- Theoretical Noise Floor_dB (Table 1) FFT Points 12Bits 14Bits 16Bits 1024 101 113 125 2048 104 116 128 4096 107 119 131 8192 110 122 134 16384 113 125 137 32768 116 128 140 SNR_dB 74.0 86.0 98.1 FFT _ _ _ _ _ _ _ _ _ _ _ _ OdB Spurious | ^ Free Dyn | | Fundamental | SNR Range | | at_max_signal v |__\ |--|---------------------------RMS_Noise_Level / | | | 3rd Harmonic | _| | __| 5rd Harmonic |/ \/\__|/\/ |_/\/ ----------- Ave Noise Level |______________________________\ (Noise Floor) ^ ^ ^ ^ ^ ^ / Bin_width Sample_rate/Number_Points_FFT F_max Sample_rate/2 RMS Signal A/SQRT(2) (FSR/2)/SQRT(2) 2^(n-1)*q/SQRT(2) RMS Noise Qn q/SQRT(12) SNR RMS_Signal/RMS_Noise 2^(n-1)*SQRT(6) SNR_pos_dB 20*log(2^(n-1)*SQRT(6)) 6.02*n + 1.76 (See Table 1) NOISE_FLOOR_neg_dB 6.02*n + 1.76 + 10*log(N/2) (See Table 1) 6.02*n +10*log(3*N/(PI*ENBW)) THD_neg_dB 20*log(SQRT(sum_of_Harm_squared) ) Note: HAR (-dB) SINAD_pos_dB -20*log( SQRT( SNR^2+THD^2 ) ) SINAD Singal to noise ratio and distortion ENOB Effective number of bits (SNR +Distort -1.76 +20*log(Amp_FS/Amp_Actual) )/6.02 fs Sampling Rate (Hz) fin Input Signal Frequency (Hz) FSR Full Scale (Input) Range of Sampling A/D Converter FS FSRi2 = Full Scale input of Sampling A/D Converter A Input Signal Amplitude FSR/2= OdB n Numberof Bitsof Resolution q LSB Size LSB Least Significant Bit N Numberof FFT Points N/2 Numberof Frequency Bins (real component) ENBW Equivalent noise bandwidth of window function. Blackman-Harris four-term Blackman-Harris window, ENBW= 2. -------------------------------------------------------------------------------------- Anti_Aliasing Filters Butterworth Flattest response near dc moderately fast roll off attenuation rate = 6dB/octave stable phase shift fc at -3dB overshoot on step response constant amplitude>>time delay or phase response Bessel Optimum flat phase response avoids overshoot/undershoot important for pulses amplitude not as flat roll off is slow gain rool off modifiy amplitude moderate attentuation rate fc at phase shift is 1/2 rate Chebyshev Rapide attenutation above cut off some bandpass ripple squarer amplitude response than butterworth less desireable phase and time delay fc at attenuation exceeds specified ripple Cauer (Elliptical) Surpasess for critical amplitude application ver sharp roll offwith some ripple squarest possible amplitude response porr phase and transient responses. ---------------------------------------------------------------------------- SciLab_Templates Cut and paste into a SciLab command window to run plots of gain_dB and Phase_deg Low_Pass_Q10 =================SciLab_Template========================= w0=2*%pi*10 // Freq = 10Hz Q=10 // Q = 10 freqmax=100 freqstep=.005 freqmin=.1 dBmax=20 dBmin=-60 Phmax=20 Phmin=-180 s=poly(0,'s') // define s as a poly symbol h=syslin('c', w0^2/(s^2+ w0*s/Q +w0^2)) // trans func'c'= cont [frq,rf]=repfreq(h,freqmin,freqmax,freqstep); // create complex frq response [db,phi]=dbphi(rf); // extact db phase vectors subplot(211) // 2X1 window first plot xgrid(); plot2d(frq,db,logflag="ln",rect=[freqmin,dBmin,freqmax,dBmax]) xtitle("Gain_vs_Freq","Freq_Hz","Gain_DB"); subplot(212) // 2X1 window second plot xgrid(); plot2d(frq,phi,logflag="ln",rect=[freqmin,Phmin,freqmax,Phmax]) xtitle("Phase_vs_Freq","Freq_Hz","Phase_deg"); High_Pass_Q10 =================SciLab_Template========================= w0=2*%pi*10 // Freq = 10Hz Q=10 // Q = 10 freqmax=100 freqstep=.005 freqmin=.1 dBmax=20 dBmin=-60 Phmax=180 Phmin=-20 s=poly(0,'s') // define s as a poly symbol h=syslin('c', s^2/(s^2+ w0*s/Q +w0^2)) // transfer funct 'c'= cont [frq,rf]=repfreq(h,freqmin,freqmax,freqstep); // create complex frq response [db,phi]=dbphi(rf); // extact db phase vectors subplot(211) // 2X1 window first plot xgrid(); plot2d(frq,db,logflag="ln",rect=[freqmin,dBmin,freqmax,dBmax]) xtitle("Gain_vs_Freq","Freq_Hz","Gain_DB"); subplot(212) // 2X1 window second plot xgrid(); plot2d(frq,phi,logflag="ln",rect=[freqmin,Phmin,freqmax,Phmax]) xtitle("Phase_vs_Freq","Freq_Hz","Phase_deg"); Band_Pass_Q10 =================SciLab_Template========================= w0=2*%pi*10 // Freq = 10Hz Q=10 // Q = 10 freqmax=100 freqstep=.005 freqmin=.1 dBmax=10 dBmin=-60 Phmax=100 Phmin=-100 s=poly(0,'s') // define s as a poly symbol h=syslin('c', (w0*s/Q)/(s^2+ w0*s/Q +w0^2)) // transfer funct 'c'= cont [frq,rf]=repfreq(h,freqmin,freqmax,freqstep); // create complex frq response [db,phi]=dbphi(rf); // extact db phase vectors subplot(211) // 2X1 window first plot xgrid(); plot2d(frq,db,logflag="ln",rect=[freqmin,dBmin,freqmax,dBmax]) xtitle("Gain_vs_Freq","Freq_Hz","Gain_DB"); subplot(212) // 2X1 window second plot xgrid(); plot2d(frq,phi,logflag="ln",rect=[freqmin,Phmin,freqmax,Phmax]) xtitle("Phase_vs_Freq","Freq_Hz","Phase_deg") Band_Reject_Q10 =================SciLab_Template========================= w0=2*%pi*10 // Freq = 10Hz Q=10 // Q = 10 freqmax=100 freqstep=.005 freqmin=.1 dBmax=10 dBmin=-60 Phmax=100 Phmin=-100 s=poly(0,'s') // define s as a poly symbol h=syslin('c', (s^2 +w0^2)/(s^2+ w0*s/Q +w0^2)) // transfer funct 'c'= cont time, [frq,rf]=repfreq(h,freqmin,freqmax,freqstep); // create complex frq response [db,phi]=dbphi(rf); // extact db phase vectors subplot(211) // 2X1 window first plot xgrid(); plot2d(frq,db,logflag="ln",rect=[freqmin,dBmin,freqmax,dBmax]) xtitle("Gain_vs_Freq","Freq_Hz","Gain_DB"); a=get("current_axes"); t=a.title; t.font_size=3; subplot(212) // 2X1 window second plot xgrid(); plot2d(frq,phi,logflag="ln",rect=[freqmin,Phmin,freqmax,Phmax]) xtitle("Phase_vs_Freq","Freq_Hz","Phase_deg") a=get("current_axes"); t=a.title; t.font_size=3; All_Pass =================SciLab_Template========================= w01=2*%pi*30 Q=.27 freqmax=10000 freqstep=.005 freqmin=.1 Phmax=20 Phmin=-180 s=poly(0,'s') // define s as a poly symbol h1=syslin('c',(s^2-s*w01/Q +w01^2)/(s^2+s*w01/Q+w01^2)) [frq1,rf1]=repfreq(h1,freqmin,freqmax,freqstep); // create complex frq response [db1,phi1]=dbphi(rf1); // extact db phase vectors xstring(0.01,1.1,["Q= .27 f1=30Hz"]) xgrid(); plot2d(frq1,phi1,logflag="ln") xtitle("Two_Pole_All_Pass_Phase_deg","Freq_Hz","Phase_deg"); a=get("current_axes"); t=a.title; t.font_size=5; t=a.x_label; t.font_size=3; t=a.y_label; t.font_size=3; Four_Pole_All_Pass =================SciLab_Template========================= w01=2*%pi*30 w02=2*%pi*3000 Q=.27 freqmax=1000000 freqstep=.005 freqmin=.1 Phmax=20 Phmin=-180 s=poly(0,'s') h1=syslin('c',(s^2-s*w01/Q +w01^2)*(s^2-s*w02/Q+w02^2)/((s^2+s*w01/Q+w01^2)*(s^2+s*w02/Q+w02^2))) [frq1,rf1]=repfreq(h1,freqmin,freqmax,freqstep); [db1,phi1]=dbphi(rf1); xstring(0.01,1.1,["Q= .27 f1=30Hz f2=3kHz"]) xgrid(); plot2d(frq1,phi1,logflag="ln") xtitle("Four_Pole_All_Pass_Phase_deg","Freq_Hz","Phase_deg"); a=get("current_axes"); t=a.title; t.font_size=5; t=a.x_label; t.font_size=3; t=a.y_label; t.font_size=3; Audio_Phase_Shifter =================SciLab_Template========================= w01=2*%pi*30 w02=2*%pi*3000 w03=2*%pi*120 w04=2*%pi*12000 Q=.27 freqmax=1000000 freqstep=.005 freqmin=.1 Phmax=20 Phmin=-180 s=poly(0,'s') h1=syslin('c',(s^2-s*w01/Q +w01^2)*(s^2-s*w02/Q+w02^2)/((s^2+s*w01/Q+w01^2)*(s^2+s*w02/Q+w02^2))) h2=syslin('c',(s^2-s*w03/Q +w03^2)*(s^2-s*w04/Q+w04^2)/((s^2+s*w03/Q+w03^2)*(s^2+s*w04/Q+w04^2))) [frq1,rf1]=repfreq(h1,freqmin,freqmax,freqstep); [db1,phi1]=dbphi(rf1); [frq2,rf2]=repfreq(h2,freqmin,freqmax,freqstep); [db2,phi2]=dbphi(rf2); xstring(0.01,1.1,["Phase_deg "]) xstring(.8,1.1,["Phase_less_90_deg "]) xgrid(); plot2d(frq1,phi1,logflag="ln") plot2d(frq2,phi2,logflag="ln") xtitle("90deg_Phase_Shifter_Phase_vs_Freq","Freq_Hz","Phase_deg"); a=get("current_axes"); t=a.title; t.font_size=5; t=a.x_label; t.font_size=3; t=a.y_label; t.font_size=3;