I am trying to simulate the transfer characteristics of a CMOS inverter using LTspice. I want to sweep the MOSFET width and length and observe the effects on rise and fall times of the CMOS inverter. Is there any way of setting up a sweep of MOSFET width and length ?

  • \$\begingroup\$ I am not really sure what you want, can you provide a minimal .asc file of what you got so far? I think something like .step nmos NMOS(w) 1u 10u 1u will do what you need... \$\endgroup\$
    – PlasmaHH
    Feb 23, 2015 at 14:17

1 Answer 1


LTspice uses the .step command to accomplish up to 3 nested sweep, to do two nested sweeps add directives like this:

.step param width 1u 10u 1u      
.step param length 1u 10u 1u      

LTspice measure for rise time and fall time:

 .MEAS TRAN tr1 WHEN V(out)=V(vdd)*0.1 RISE=1
 .MEAS TRAN tr2 WHEN V(out)=V(vdd)*0.9 RISE=1
 .MEAS TRAN tr PARAM (tr2-tr1)
 .MEAS TRAN tf1 WHEN V(out)=V(vdd)*0.9 FALL=1
 .MEAS TRAN tf2 WHEN V(out)=V(vdd)*0.1 FALL=1
 .MEAS TRAN tf PARAM (tf2-tf1)

You will find the output of the measure commands in the log (Ctrl-L).

If you are drawing the transistors you may need to wrap the parameters in {}-brackets.

If you write the netlist yourself you need a .param directive, e.g.:

 .param width=1u length=1u
 Mnmos1 D G S B model w={width} l={length}

Below is a working example:

example of two parameter sweep in LTspice

After running it hit Ctrl-L or use the menu item 'spice error log' to see the measure results. For simpler measure setups you cant plot the results by right clicking in the 'spice error log' window, but it didn't work in this case so you need to process it in another program.

  • \$\begingroup\$ my MOSFET model is defined as : Mnmos@0 output input gnd gnd NMOS L=0.4U W=2U Mpmos@0 vdd input output vdd PMOS L=0.4U W=2U how do i change the L and W for both Mnmos@0 and Mpmos@0 ? \$\endgroup\$
    – ironstein
    Feb 21, 2015 at 16:44
  • \$\begingroup\$ No problem for the answer so far, but I just realized I'm out of time, so I will have too come back to do a full example (maybe later today). \$\endgroup\$
    – HKOB
    Feb 21, 2015 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.