Plot a curve with its derivatives

조회 수: 10 (최근 30일)
Alexandra McClernon Ownbey
Alexandra McClernon Ownbey 2020년 2월 4일
I have data with the following information and coordinates (not the actual numbers, just an example):
X Y dY/dX d2Y/dX2
4 0.3 5e-4 4.1e-5
5 0.4 1e-4 3e-4
In the example, there are only two points, but in the data, I have over 1000. I would like to plot the curve defined by the x and y-coordinates while maintaining the 1st and 2nd derivatives at each point. Is there a way to do this in matlab? I am not looking to use a linear fit curve. Each x-y value is given its own 1st and 2nd derivative.
  댓글 수: 3
Alexandra McClernon Ownbey
Alexandra McClernon Ownbey 2020년 2월 4일
편집: Alexandra McClernon Ownbey 2020년 2월 4일
If I plot a curve in matlab (or any software) with x-y coordinates, it basically interpolates a line (via e.g. taylor series) between the points to make it continuous. So if I have 4 points that I plot, I get a curve; however, the slope (derivative) at those points are then defined by whatever interpolation or curve the software uses to connect the points. I would like to define what the slope is at each point.
These points are 2nd order accurate, I would like to maintain that accuracy. If I just input points to plot, I lose my accuracy.
I don't think I can create a function for the points - they are coordinates for a nozzle.
Alexandra McClernon Ownbey
Alexandra McClernon Ownbey 2020년 2월 4일
The only thing I can think of is to use taylor series to add points just after and before the points i have to make sure the derivative is correct

댓글을 달려면 로그인하십시오.

답변 (1개)

J. Alex Lee
J. Alex Lee 2020년 2월 4일
As far as I know, matlab's plot function will draw a straight line (linear interpolation) between adjacent points.
For your case, at every point you have a fully specified parabola, so you can draw as refined a plot as you would like around each point.
You could try plotting the parabola around each point, say from mid-way between it and the previous, and mid-way between it and the next, and look at the result. I suspect you won't get a continuous curve though.
I think that at best you will be able to find x-positions between the specified points where the parabolas will meet, but they will not be ensured to have matched slopes (and definitely not 2nd derivatives).
  댓글 수: 1
Alexandra McClernon Ownbey
Alexandra McClernon Ownbey 2020년 2월 4일
I just ended up using taylor series to approximate coordinates above and below each given coordinate using a extremely small dx.

댓글을 달려면 로그인하십시오.

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by