Borrar filtros
Borrar filtros

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 visualizaciones (últimos 30 días)
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

Respuestas (1)

Star Strider
Star Strider el 20 de Mayo de 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.

Categorías

Más información sobre Polynomials en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by