Date: Sep 9, 2013 2:10 PM
Author: Kenneth Potter
Subject: Problem with matlab diff function
Dear Forum Members
I am using MATLAB R2012b with Windows 7 and have encountered the following problem which I would appreciate any help with.
I have created a simple script to read in data from an excel file capturing a C-V sweep of Capacitance vs Voltage.
I have then used the "diff" function within MATLAB to create a new array dC/dV.
In the original script file I have plotted dC/dV versus V and obtained in simple terms a parabola which has a minimum below the x-axis.
I have then created a new script file which reads from a different excel file and cut and paste the diff code to plot dC/dV versus V
However, the graphical output now shows a parabola with a maximum above the x-axis ( in effect this is equivalent to multiplying (dC/dV by -1).
Both input files have the same graph for C vs V (ignoring minor measurement differences) so in application both dC/dV vs V plots should have a result which has a local minima rather than one with a local minima and the other with a local maxima.
I have compared the two files looking at the critical script coding and find no differences in the manipulation of the Capacitance array or the voltage array.
I would greatly appreciate any assistance as I have been attempting to solve this trivial problem for almost a day.
The script files are quite long so I have not included them at the moment but where necessary can supply if required.
Thank you greatly for any feedback.