Filter löschen
Filter löschen

Hi, I have a x vs y text data file. I want to find the maximum and minimum value of first derivative of the y w.r.t x and store the corresponding x and y values. Can anyone tell me the MATLAB code for that? Thanks in advance!

2 Ansichten (letzte 30 Tage)
This is the code I have written:
>> a = load('xaxisfig7line1'); >> y = a(:,2); >> x = a(1,:); >> dy = diff(y)./diff(x);
Next How do I find the corresponding x and y values for a particular value of dy and store it in a file? Thanks, Anuradha

Antworten (1)

Star Strider
Star Strider am 20 Mai 2016
Use the gradient function, not diff to calculate the derivative. It is the same size as the argument vector. This assumes that your ‘x’ values are evenly-spaced. See the documentation for details.
If the ‘x’ vector are not evenly-spaced (or acceptably close), consider using the polyfit, polyder, and polyval functions. The documentation for those functions will tell you how to use them. Use the lowest-order polynomial that will provide an acceptable fit to your data. Usually you can do this with at most a 7th-order polynomial.

Kategorien

Mehr zu Polynomials finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by