The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Problem with matlab diff function
Replies: 1   Last Post: Sep 9, 2013 4:25 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Kenneth Potter

Posts: 11
Registered: 2/24/05
Problem with matlab diff function
Posted: Sep 9, 2013 2:10 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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.

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.