# LTSpice: How to write a behaviorial model?

Discussion in 'CAD' started by Mike Rocket J. Squirrel Elliott, Nov 6, 2003.

1. ### Mike Rocket J. Squirrel ElliottGuest

I need to drive an amplifier circuit from a pre-emphasized voltage
source. The goal being to confirm that the complementary de-emphasis
portion of the circuit results in overall flat frequency response.

Generally speaking, when doing an .ac analysis, the signal source is
held at a constant amplitude and swept from the start to the stop
frequency. In my application, I need to vary the amplitude as a function
of frequency as it sweeps.

This appears to be a job for the "B" function. Alas, my math skills are
too puny to attack the problem.

Beige Bag SPICE shows how to do exactly what I want to do for their
software at

http://www.beigebag.com/case_riaa_2.htm ,

It is the Inverse RIAA Parameters that I am wanting to stir into the B
model. I'm not seeing how to write a B behavioral model of the inverse
RIAA equalization transfer function in LTSpice from their example.

2. ### Mike EngelhardtGuest

Mike,
Basically, you change the word "gain" to "Laplace". Below is
a schematic that uses the equation from that site. Note I used
the reciprocal so that the response was more easily recognizable
as RIAA equalization. Just change the value of E1 to
Laplace=(1 + 3.18e-3*s)*(1 + 7.5e-5*s)/(1 + 3.18e-4*s) to
get the inverse. Note that LTspice will also execute the
PSpice syntax for these things, which while a bit more cumbersome,
is the most widely used standard I know of.

--Mike

--- RIAA.asc ---
Version 4
SHEET 1 880 680
WIRE 32 64 32 96
WIRE 32 176 32 192
WIRE -144 240 -144 208
WIRE -144 128 -144 112
WIRE -144 112 -16 112
WIRE -16 160 -32 160
FLAG 32 192 0
FLAG -32 160 0
FLAG -144 240 0
SYMBOL e 32 80 R0
WINDOW 3 28 94 Left 0
SYMATTR Value Laplace=1/((1+3.18e-3*s)*(1+7.5e-5*s)/(1+3.18e-4*s))
SYMATTR InstName E1
SYMBOL voltage -144 112 R0
SYMATTR InstName V1
SYMATTR Value ac 1
TEXT -56 248 Left 0 !.ac oct 100 1 100K

3. ### Mike Rocket J. Squirrel ElliottGuest

Mike,

That's brilliant -- thank you!

Do you ever sleep?

4. ### Uwe BonnesGuest

: Basically, you change the word "gain" to "Laplace". Below is
: a schematic that uses the equation from that site. Note I used
: the reciprocal so that the response was more easily recognizable
: as RIAA equalization. Just change the value of E1 to
: Laplace=(1 + 3.18e-3*s)*(1 + 7.5e-5*s)/(1 + 3.18e-4*s) to
: get the inverse. Note that LTspice will also execute the
: PSpice syntax for these things, which while a bit more cumbersome,
: is the most widely used standard I know of.

: --Mike

: --- RIAA.asc ---
<snipped>

Mike,
please consider including the examples from the last postings into the
release.

Thanks