필터 지우기
필터 지우기

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 (최근 30일)
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

답변 (1개)

Star Strider
Star Strider 2016년 5월 20일
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.

카테고리

Help CenterFile Exchange에서 Polynomials에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by