# Why is my simulation results are not matching to the theoretical data?

I have a circuit You can down here

I am trying to find out the transfer function of Voltage across L3/Input Voltage.

When you probe at L3, you can see the voltage generated. This is what I am trying to replicate in my transfer function output.

I am using lsim to calculate the system output.

lsim(test,input,time) here input = modulator output at Q.

time = 1:1:length of input;

I am getting strange result incase of transfer function output.

I have verified the transfer function multiple times and it seems to me that the derivation of transfer function is proper.

What is wrong here ? can someone help me to verify this.

Thanks.

• See this: electronics.stackexchange.com/questions/255085/… . In your case, delete A1 and V2, connect V1 to R1 and replace V1's value with AC 1. Then, instead of a Transient analysis, do an AC analysis, by Right-Clicking on the .tran 0.1 and changing to the correct tab. You can choose any type, but here's a start: type = decade, nr. points = 100, start = 1k, stop = 1G. – a concerned citizen Sep 1 '16 at 6:01
• Note that the modulator has a default output resistance of 1 Ohm. To change it, add Rout=<value> in its attributes. Also, if you only need a fixed AM amplitude, there's no need for an extra voltage (V1); instead, you can add Vhigh=<value> and Vlow=<value> to the attributes, just like any A-device. – a concerned citizen Sep 1 '16 at 6:09
• @aconcernedcitizen...Thanks. but if you can, then can you please confirm on above transfer function ? – cppiscute Sep 1 '16 at 11:20
• @aconcernedcitizen...By doing the ac analysis I got the magnitude and phase response...and which are clearly not matching to what I obtained from transfer function. so there is something wrong in the transfer function ? – cppiscute Sep 1 '16 at 11:29
• I'm a bit on the run now, but I would say it's safe to trust what LTspice is showing. :-) Given your transfer function, you could try it in LTspice, too, with an E source with the value Laplace=(s^2+10)/(s^2+0.5*s+1) (just an example). Note that this is the only place LTspice accepts ^ as exponentiation, elsewhere is **. One more note: don't run a Laplace function in .TRAN, it's very inefficient and prone to errors; use RLC to create your own transfer function and .TRAN will run blazingly fast (and accurate). That's it, gotta run. Good luck! – a concerned citizen Sep 1 '16 at 12:32

I don't have Matlab, but I have QSapecNG, precisely for those cases where everything gets too complicated to do it on paper. Given your circuit, here's what it outputs:

C1 * C2 * L2 * L3 * V1 * s^4 + C1 * C2 * L3 * RL * V1 * s^3 + C1 * L3 * V1 * s^2
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
( C1 * C2 * L2 * L3 + C1 * C2 * L1 * L3 + C1 * C2 * L1 * L2 ) * s^4 + ( C1 * C2 * L3 * RL + C1 * C2 * L1 * RL + C1 * C2 * L3 * R1 + C1 * C2 * L2 * R1 ) * s^3 + ( C1 * C2 * R1 * RL + C1 * L3 + C1 * L1 + C2 * L3 + C2 * L2 ) * s^2 + ( C1 * R1 + C2 * RL ) * s + 1


After sifting through the terms, the only difference is that the b0 term is 1, not 0. Maybe you copied it wrong? At any rate, adding it to LTspice makes the plots coincide. Here's the schematic:

Version 4
SHEET 1 1268 680
WIRE 48 -96 -128 -96
WIRE -176 -80 -256 -80
WIRE -256 80 -256 -80
WIRE -176 80 -256 80
WIRE -64 80 -96 80
WIRE 32 80 0 80
WIRE 160 80 112 80
WIRE 256 80 160 80
WIRE 400 80 336 80
WIRE 544 80 464 80
WIRE 160 128 160 80
WIRE 544 128 544 80
WIRE -256 160 -256 80
WIRE -256 256 -256 240
WIRE 160 256 160 208
WIRE 160 256 -256 256
WIRE 544 256 544 208
WIRE 544 256 160 256
WIRE 160 304 160 256
FLAG 160 304 0
FLAG -176 -32 0
FLAG -128 -16 0
SYMBOL res -80 64 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R1
SYMATTR Value 0.01
SYMBOL cap 0 64 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName C1
SYMATTR Value 46.17e-9
SYMBOL ind 16 96 R270
WINDOW 0 32 56 VTop 2
WINDOW 3 5 56 VBottom 2
SYMATTR InstName L1
SYMATTR Value 20.56e-6
SYMBOL ind 144 112 R0
SYMATTR InstName L3
SYMATTR Value 40.46e-6
SYMBOL ind 240 96 R270
WINDOW 0 32 56 VTop 2
WINDOW 3 5 56 VBottom 2
SYMATTR InstName L2
SYMATTR Value 20.49e-6
SYMBOL cap 464 64 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName C2
SYMATTR Value 46.09e-9
SYMBOL res 528 112 R0
SYMATTR InstName RL
SYMATTR Value 7.93
SYMBOL voltage -256 144 R0
WINDOW 3 37 61 Left 2
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR Value ac 1
SYMATTR InstName V1
SYMBOL e -128 -112 R0
SYMATTR InstName E1
SYMATTR Value Laplace = (a4*(s/w)^4 + a3*(s/w)^3 + a2*(s/w)^2 + a1*s/w + a0) / (b4*(s/w)^4 + b3*(s/w)^3 + b2*(s/w)^2 + b1*s/w + b0)
TEXT 656 24 Left 2 !.param R1=10m RL=7.93\n+ C1=46.17n C2=46.09n\n+ L1=20.56u L2=20.49u Lm=40.46u
TEXT 656 112 Left 2 !.param a4 = L2*Lm*C1*C2\n+ a3 = Lm*C1*C2*RL\n+ a2 = Lm*C1\n+ a1=0  a0=0
TEXT 656 216 Left 2 !.param b4 = C1*C2*(L1*L2 + L1*Lm + L2*Lm)\n+ b3 = C1*C2*(L2*R1 + L1*RL + Lm*R1 + Lm*RL)\n+ b2 = L2*C2 + L1*C1 + R1*RL*C1*C2 + Lm*C2 + Lm*C1\n+ b1 = R1*C1 + RL*C2\n+ b0 = 1
TEXT 256 -72 Left 2 !.param w=1
TEXT -208 320 Left 2 !.ac dec 100 1k 1g

• Thousand thanks to you for finding that "b0" mistake. Now my theoretical data matches to that of Ltspice data. If it's really that easy to get the transfer function of any circuit by just building the circuit, I would really like to check "QSapecNG". Regards – cppiscute Sep 1 '16 at 21:24