I was trying to plot the transconductance of a FET and the first 2 derivatives of it using Agilent ADS. Agilent has a diff() function that takes the nearest 2 points to compute the derivative of a data set. The problem is when it reaches the end it runs out of data.
Syntax: y = diff(data, pad)
pad = pad the differentiated data with an extra value [0, 1] integer 0 no
If pad is 1, then the differentiated data is padded with an extra value (last value of differentiated data) to make it the same length as the data to be differentiated. If 0 (default) then the length of the differentiated data is one less than the length of data to be differentiated
The problem is that the code has a bug in that it continues to differentiate till the last data point which means the first derivative's last value is always equal to 0 when padded. That means the second derivative's last value shoots up to a large value because between the first derivatives next to last point and last point there is a sudden discontinuity.
I thought I had found a solution to this by turning off padding. It indeed gets around the issue however if you need to do any OTHER math functions on your dataset then it appears you have to have full length derivative data. Otherwise it just refuses to plot the function. My comprimise was to turn off padding for the first derivative and leave it on for the rest. This gave me the "go to zero rapidly at the end of data" problem but at least it was contained enough in range to allow for good plots.
Research Links
0 Comments