Below is a very simple circuit to extract the transconductance value of the MOSFET.

As it is known, transconductance is known as Delta (Id) / Delta (Vgate).

For the gate voltage, I defined it as .step param X 0 12 0.5.

To make ΔID/ΔVGS and get the result of transconductance ı write dot parameters as follow:

.param Vhigh {X}  
.param Vlow {X-0.5}  
.save V(Vg) Id(M1)  
.meas TRAN Id_high FIND Id(M1) WHEN V(Vg)=Vhigh  
.meas TRAN Id_low FIND Id(M1) WHEN V(Vg)=Vlow  
.meas TRAN gm PARAM (Id_high-Id_low)/(Vhigh-Vlow)  
.print gm
                                                                                 
When ı check the Spice error log , Id_high - Id_low and gm  values are negative. Why ? What is wrong with my dot parameters ?

[![enter image description here][1]][1]


[![enter image description here][2]][2]
Source: https://www.mouser.com.tr/datasheet/2/240/media-3322045.pdf

[![enter image description here][3]][3]

[![enter image description here][4]][4]


  [1]: https://i.sstatic.net/M649Iyup.png
  [2]: https://i.sstatic.net/M1VkbOpB.png
  [3]: https://i.sstatic.net/HlKB2EBO.png
  [4]: https://i.sstatic.net/192bzc93.png