SPICE AC analysis -- multiplying or dividing signals

Does anyone know how, in SPICE (LTSpice, SIMetrix, etc.), one goes about multiplying or dividing two voltages in an AC analysis?

I have an arbitrary voltage generator device ("B"), but for non-linear equations such as V(node1)*V(node2), there's some linearization that occurs and I usually just get 0v output as a result rather than a multiplication.

After simulation I have no problem *graphing* something like V(node1)*V(node2), but what I wanted was to create a new node that presented that signal...

Thanks,

---Joel Kolstad

Reply to
Joel Kolstad
Loading thread data ...

Better explanation ?:-)

...Jim Thompson

--
|  James E.Thompson, P.E.                           |    mens     |
|  Analog Innovations, Inc.                         |     et      |
|  Analog/Mixed-Signal ASIC\'s and Discrete Systems  |    manus    |
|  Phoenix, Arizona            Voice:(480)460-2350  |             |
|  E-mail Address at Website     Fax:(480)460-2142  |  Brass Rat  |
|       http://www.analog-innovations.com           |    1962     |
             
I love to cook with wine.      Sometimes I even put it in the food.
Reply to
Jim Thompson

"Joel Kolstad" schrieb im Newsbeitrag news: snipped-for-privacy@corp.supernews.com...

Hello Joel,

It's impossible to multiply or divide two AC-signals in a useful way for .AC-analysis. Multiplying two AC-signals would result in doubling the frequency. This is not the concept of the AC-analysis in SPICE. AC-analysis is a pure linear analysis by definition.

Best regards, Helmut

Reply to
Helmut Sennewald

Nonsense.

Nonsense again. .AC analysis produces magnitude and phase numbers, NOT sinusoids.

Yes, it is linear, but you can do mathematical analysis (at least in PSpice Probe) on the results.

(It can get tricky, shifting results by so many dB's for example, but it can be done.)

...Jim Thompson

--
|  James E.Thompson, P.E.                           |    mens     |
|  Analog Innovations, Inc.                         |     et      |
|  Analog/Mixed-Signal ASIC\'s and Discrete Systems  |    manus    |
|  Phoenix, Arizona            Voice:(480)460-2350  |             |
|  E-mail Address at Website     Fax:(480)460-2142  |  Brass Rat  |
|       http://www.analog-innovations.com           |    1962     |
             
I love to cook with wine.      Sometimes I even put it in the food.
Reply to
Jim Thompson

Hi Helmut,

Hmm... I think I see what you mean. However, I don't want to perform "instantaneous" mixing, as you suggest, I just want to multiple two phasors (complex numbers) together at each frequency point to get a new one. I'm thinking there's no way to set up the matrix in AC analysis to try to solve for V(node1)*V(node2), yet of course once V(node1) and V(node2) are known it's trivial to calculate V(node1)*V(node2) using the post processor. I guess I'll settle for that.

I suppose this is why the traditional "voltage controlled voltage source" can only multiple by a constant...

---Joel

Reply to
Joel Kolstad

Hi Jim,

"Jim Thompson" wrote in message news: snipped-for-privacy@4ax.com...

The approach you're taking is what I want to do, I just wanted to create a voltage source repsenting that result. The idea was to be able to drop a "Probe - dB", "Probe - magnitude", etc. sort of part on that voltage source.

---Joel

Reply to
Joel Kolstad

What simulator are you using? I have a macro for PSpice Probe for shifting results, but I suspect it only works in PSpice.

...Jim Thompson

--
|  James E.Thompson, P.E.                           |    mens     |
|  Analog Innovations, Inc.                         |     et      |
|  Analog/Mixed-Signal ASIC\'s and Discrete Systems  |    manus    |
|  Phoenix, Arizona            Voice:(480)460-2350  |             |
|  E-mail Address at Website     Fax:(480)460-2142  |  Brass Rat  |
|       http://www.analog-innovations.com           |    1962     |
             
I love to cook with wine.      Sometimes I even put it in the food.
Reply to
Jim Thompson

Multiplying two complex numbers together can be done with PSpice _behavioral_ controlled sources, NOT your plain vanilla E-source.

...Jim Thompson

--
|  James E.Thompson, P.E.                           |    mens     |
|  Analog Innovations, Inc.                         |     et      |
|  Analog/Mixed-Signal ASIC\'s and Discrete Systems  |    manus    |
|  Phoenix, Arizona            Voice:(480)460-2350  |             |
|  E-mail Address at Website     Fax:(480)460-2142  |  Brass Rat  |
|       http://www.analog-innovations.com           |    1962     |
             
I love to cook with wine.      Sometimes I even put it in the food.
Reply to
Jim Thompson

Hi Jim,

"Jim Thompson" wrote in message news: snipped-for-privacy@4ax.com...

SIMetrix. We do have a copy of PSpice around, but I prefer the SIMetrix interface (since with PSpice for the schematic part we're using Capture -- I imagine you'd suggest that's part of the problem :-) ).

---Joel

Reply to
Joel Kolstad

"Joel Kolstad" schrieb im Newsbeitrag news: snipped-for-privacy@corp.supernews.com...

Hello Joel,

I exactly know what you wnat to do. Believe me, your idea is not possible with the concept of the .AC-analysis in SPICE. You can do what you need in the waveform viewer of LTspice of course.

Best regards, Helmut

Reply to
Helmut Sennewald

Yep ;-)

But I believe PSpice macros may work with (or be adaptable to) SIMetrix.

Macro:

VdBnorm(A,B)=VdB(A)*PWR(10,(B/20))

...Jim Thompson

--
|  James E.Thompson, P.E.                           |    mens     |
|  Analog Innovations, Inc.                         |     et      |
|  Analog/Mixed-Signal ASIC\'s and Discrete Systems  |    manus    |
|  Phoenix, Arizona            Voice:(480)460-2350  |             |
|  E-mail Address at Website     Fax:(480)460-2142  |  Brass Rat  |
|       http://www.analog-innovations.com           |    1962     |
             
I love to cook with wine.      Sometimes I even put it in the food.
Reply to
Jim Thompson

You can certainly do phasor multiplication with behavioral sources in PSpice.

...Jim Thompson

--
|  James E.Thompson, P.E.                           |    mens     |
|  Analog Innovations, Inc.                         |     et      |
|  Analog/Mixed-Signal ASIC\'s and Discrete Systems  |    manus    |
|  Phoenix, Arizona            Voice:(480)460-2350  |             |
|  E-mail Address at Website     Fax:(480)460-2142  |  Brass Rat  |
|       http://www.analog-innovations.com           |    1962     |
             
I love to cook with wine.      Sometimes I even put it in the food.
Reply to
Jim Thompson

"Jim Thompson" schrieb im Newsbeitrag news: snipped-for-privacy@4ax.com...

Hello Jim,

please show me a SPICE netlist which can do that. We don't talk about PROBE.

Best regards, Helmut

Reply to
Helmut Sennewald

[snip]

Ebeh nodeP nodeN VALUE {expression to suit your fancy}

and given that

R(V(A)) = real part of V(A)

IMG(V(A)) = imaginary part of V(A)

what are you having a problem with?

...Jim Thompson

--
|  James E.Thompson, P.E.                           |    mens     |
|  Analog Innovations, Inc.                         |     et      |
|  Analog/Mixed-Signal ASIC\'s and Discrete Systems  |    manus    |
|  Phoenix, Arizona            Voice:(480)460-2350  |             |
|  E-mail Address at Website     Fax:(480)460-2142  |  Brass Rat  |
|       http://www.analog-innovations.com           |    1962     |
             
I love to cook with wine.      Sometimes I even put it in the food.
Reply to
Jim Thompson

"Jim Thompson" schrieb im Newsbeitrag news: snipped-for-privacy@4ax.com...

Hello Jim,

I still don't understand how your expression could look in the example above to perform a multiplication of two node voltages each having AC voltages in the .AC-simulation. In LTspice you can't write anything like IM(V(A)) in an expression of a B-source.

Best regards, Helmut

Reply to
Helmut Sennewald

It seems to work here in PSpice, but it's "IMG", not "IM"

I haven't tried it, but the multiplication may require multiple steps to accomplish.

(1) Separate out the real and imaginary parts (2) Do the appropriate multiplications (3) Sum appropriate parts to get the resultant real and imaginary terms

...Jim Thompson

--
|  James E.Thompson, P.E.                           |    mens     |
|  Analog Innovations, Inc.                         |     et      |
|  Analog/Mixed-Signal ASIC\'s and Discrete Systems  |    manus    |
|  Phoenix, Arizona            Voice:(480)460-2350  |             |
|  E-mail Address at Website     Fax:(480)460-2142  |  Brass Rat  |
|       http://www.analog-innovations.com           |    1962     |
             
I love to cook with wine.      Sometimes I even put it in the food.
Reply to
Jim Thompson

Hi Jim,

"Jim Thompson" wrote in message news: snipped-for-privacy@4ax.com...

With my original problem -- getting S parameters out of SPICE -- I ended up having to use an AC source to accomplish subtraction. Something like

B1 n+ n- V=2/5*node-1

...didn't work, whereas just "V=2/5*node" did... hence the solution mentioned.

I'm a pretty happy campy... I can now drop down "port" parts that have terminals on them, one providing S11, the other providing S21... I then drop one something like a dB probe marker, and I'm set.

Thanks for the suggestions,

---Joel (Happily abusing SPICE by trying to make it into a linear RF simulator...)

Reply to
Joel Kolstad

Surf around, particularly on the PSpice sites. I vaguely recall a cute way to get S-parameters.

I may have already downloaded a copy. I'll look.

...Jim Thompson

--
|  James E.Thompson, P.E.                           |    mens     |
|  Analog Innovations, Inc.                         |     et      |
|  Analog/Mixed-Signal ASIC\'s and Discrete Systems  |    manus    |
|  Phoenix, Arizona            Voice:(480)460-2350  |             |
|  E-mail Address at Website     Fax:(480)460-2142  |  Brass Rat  |
|       http://www.analog-innovations.com           |    1962     |
             
I love to cook with wine.      Sometimes I even put it in the food.
Reply to
Jim Thompson

here you go....

formatting link

...Jim Thompson

--
|  James E.Thompson, P.E.                           |    mens     |
|  Analog Innovations, Inc.                         |     et      |
|  Analog/Mixed-Signal ASIC\'s and Discrete Systems  |    manus    |
|  Phoenix, Arizona            Voice:(480)460-2350  |             |
|  E-mail Address at Website     Fax:(480)460-2142  |  Brass Rat  |
|       http://www.analog-innovations.com           |    1962     |
             
I love to cook with wine.      Sometimes I even put it in the food.
Reply to
Jim Thompson

Jim,

I think you're missing Helmut's point. In the simulation, the behavior source's are linearized just like any other non-linear devices like diodes and transistors. Yes, you can multiply a signal path and see the gain of the complex signal through the path. But that's as close as you can get to "You can certainly do phasor multiplication with behavioral sources in PSpice." That is, you can do the complex multiplication with behavioral sources but only if one of the products is *real*. I.e., your statement is incorrect. Division is only possible if the divisor is real. Helmut is just trying to help because this is a point that I think just about every gets confused about in SPICE .ac analysis along the learning curve, but it seems impossible to explain to someone -- or at least just not worth it. It's one of those things that people seem to have to figure out for themselves.

To the OP, one industry-standard way to get S-parameters out of a SPICE simulation is with hspice's .net statement. It will compute S-, H-, Z-, and Y- matrices of a two-port linear network. A super-set of this command is availible in LTspice if you don't have a copy of hspice. The pertaine example case is installed by default as C:\\Program Files\\LTC\\SwCADIII\\examples\\Educational\\S-param.asc

Regards,

--Mike

"Jim Thompson" wrote in message news: snipped-for-privacy@4ax.com...

Reply to
Mike Engelhardt

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.