Effacer les filtres
Effacer les filtres

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 vues (au cours des 30 derniers jours)
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

Réponses (1)

Star Strider
Star Strider le 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.

Catégories

En savoir plus sur Polynomials dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by