Open lnelectronic opened 3 months ago
Take existing oscillator and run FFT of inductor current and then call f0() function to get fundamental frequency:
var f = fft().run('I(L1.L0)').chart_db('I(L1.L0)');
echo('f0 = ' + f.f0().frequency);
This will print f0 = 17357.854003907454 which 17kHz. Entire example:
battery({"rs":10,"name":"U1","anode":"bat","cathode":0,"v":3.3});
capacitor({"name":"Cd","anode":"bat","cathode":0,"c":0.000009999999999999999});
inductor({"name":"L1","anode":"net3","cathode":"net2","l":0.00091,"rs":6.5});
npn({"name":"T1","c":"net2","b":"net3","e":0,"model":"2N3904"});
resistor({"name":"R1","anode":"net1","cathode":"bat","r":180000});
resistor({"name":"R2","anode":"bat","cathode":"net2","r":820});
resistor({"name":"R3","anode":"net1","cathode":"net3","r":10});
capacitor({"name":"C1","anode":"net1","cathode":"bat","c":4.7000000000000004e-8});
capacitor({"name":"C2","anode":"net2","cathode":"net3","c":3.899999999999999e-9});
capacitor({"name":"C3","anode":"net2","cathode":"bat","c":0.0000014999999999999996});
bjt_model({"name":"2N3904","kind":"NPN","bf":205,"is":1.26547e-10,"vaf":998.433,"ptf":0,"rbm":0.632479,"vtf":8.74751,"isc":2.31414e-9,"vjs":0.749273,"ne":3.31282,"re":0.0000995788,"tr":6.85197e-8,"irb":50.5208,"fc":0.512359,"ikf":0.0273521,"xtb":0.100589,"cjc":3.78079e-12,"tf":4.23873e-10,"af":1,"vjc":0.402828,"nc":1.99306,"ikr":0.274173,"br":20.7773,"var":9.40218,"cjs":0,"kf":0,"mje":0.256354,"nr":2.89455,"rb":5.83249,"nf":1.50082,"mjc":0.239341,"cje":4.67206e-12,"xti":1,"vje":0.404156,"rc":2.65908,"mjs":0.502839,"itf":0.0106626,"ise":2.29887e-9,"xcjc":0.79747,"xtf":0.913471,"eg":1.04619});
var f = fft().run('I(L1.L0)').chart_db('I(L1.L0)');
echo('f0 = ' + f.f0().frequency);
But this program finds more or less random oscillators, idea is to first find the oscillator and then you tune it to frequency you want.
I am interested in lc-oscillator. I would like to know how to calculate frequency output.
thanks you.