Plot a curve with its derivatives
14 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
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).
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interpolation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!