Go Back   Home > Forums > >
Home Forums Rules Articles diyAudio Store Blogs Gallery Wiki Register Donations FAQ Calendar Search Today's Posts Mark Forums Read

Software Tools SPICE, PCB CAD, speaker design and measurement software, calculators

LTSpice variable values question
LTSpice variable values question
Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Thread Tools Search this Thread
Old 24th March 2015, 07:54 PM   #1
Trileru is offline Trileru  Romania
diyAudio Member
Join Date: Dec 2010
Default LTSpice variable values question

I'm trying to simulate an output stage with LTSpice and want to check what is the lowest noise I can get out of it by varying certain components.
So far so good. I need to vary one resistor but that resistor changes the bias of the output stage. It's not the bias setting resistor, but another resistor.
Now, I have to use the .step param for those two resistors so I can keep the bias at roughly the same value when varying the resistor in question. In the classical way that I know how to use this option the software will basically run through each step of the simulation like this.
Let's say res1 and res2 are the variables, and the values are from 10 to 100 in steps of 10 (ohms) for each.
The software will make 100 iterations for this setup as first it will use 10 ohms for res1 and 10 ohms for res2.
The second iterations will be with 20 ohms for the first resistor and 10 ohms for the second. and so on.
I'd like to know how to step two values at the same time. So the software will make a sim for 10/10 ohms then the second sim to be for 20/20 ohms.
  Reply With Quote
Old 24th March 2015, 08:41 PM   #2
jcx is offline jcx  United States
diyAudio Member
Join Date: Feb 2003
Location: ..
you can step a numeric parameter say X

then you can calculate the value of each R based on a equation in X

{X*100} or {X + 1k} the curly braces in a component's value field makes it calculate the value

more indirectly you can make the .step param be the index into tables of values for each component
the syntax is obscure - example files in the Yahoo LTspice group

Originally Posted by analogspiceman View Post
There is a very active Yahoo Group dedicated to LTspice. It's at http://groups.yahoo.com/group/LTspice. Your particular question has been discussed there several times. All posts are archived and are searchable. Also, the files section contains much useful reference material, models, and example circuits.

You can make the values of the components you wish to vary a table function of a stepped parameter. Use the ".step" command to step the controlling parameter (e.g. .step param n list 1 2 3...) to get several runs to appear in one plot. Then edit the value field of the target components to depend on this parameter (e.g. {tbl(n,1,1k,2,1p,3,1T} ). Be sure to enclose the parametrized expression in curly braces. Use extremely large values to "disconnect" the component and extremely small values to short it out.

To display only a particular step in the plot window suffix the trace expression with the step selection operator "@n", where n is the desired step number.

Most of this information is contained in the help file and is accessible via the help search function.
  Reply With Quote
Old 24th March 2015, 09:10 PM   #3
Trileru is offline Trileru  Romania
diyAudio Member
Join Date: Dec 2010
Thank you very much
I must read on this on the yahoo group.
  Reply With Quote
Old 25th March 2015, 04:17 PM   #4
Mosquito is offline Mosquito  Argentina
diyAudio Member
Mosquito's Avatar
Join Date: Sep 2009
Location: Santa Fe, Argentina
.step param X list 10 20 30 40 .....100
then name res1 = {X} and res2 = {X}
the same as per step varying the two halves of a PP output transformer at once
  Reply With Quote
Old 25th March 2015, 07:36 PM   #5
Trileru is offline Trileru  Romania
diyAudio Member
Join Date: Dec 2010
This is how I solved it:
.step param N 1 12 1
.param RES1=table(N,1,40,2,50,3,60,4,70,5,80,6,90,7,100,8 ,110,9,120,10,130,11,140,12,150)
.param RES2=table(N,1,317,2,322,3,327,4,332,5,337,6,342,7 ,347,8,351.5,9,356,10,360.5,11,364.5,12,368)

Someone over at LTSpice Yahoo group gave me the solution.
  Reply With Quote


LTSpice variable values questionHide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
LTSpice Error Log THD values macplauder Software Tools 3 12th February 2015 07:21 PM
Variable Resistor values Karl vd Berg Parts 5 10th October 2013 06:14 PM
Variable PS question Ripcord Power Supplies 2 25th September 2013 03:16 AM
LTspice / newbie question 3n2323 Solid State 27 26th April 2012 11:27 AM
Generic snubber values: fixed-/variable-voltage regs hollowman Power Supplies 44 28th April 2008 10:09 PM

New To Site? Need Help?

All times are GMT. The time now is 08:03 AM.

Search Engine Optimisation provided by DragonByte SEO (Pro) - vBulletin Mods & Addons Copyright © 2018 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 15.79%
vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2018 DragonByte Technologies Ltd.
Copyright ©1999-2018 diyAudio