fitting a curve on 3d data

9 次查看(过去 30 天)
prashant singh
prashant singh 2017-12-31
i have 3d data and I have plotted it using
scatter3(data(:,3),data(:,1) ,data(:,2));
I want to plot a curve along this 3d data, something like
Also how once i have plotted i want to extend the curve and get the x and y points (data(:,1) and data(:,2)) till my z points (data(:,3)) becomes 0. z usually starts from 35 and goes till 128. once the curve is fit i want to know the x and y points corresponding to z(0:34). Uploading the data.mat.
  4 个评论
prashant singh
prashant singh 2018-1-1
@Matt the line was ok but it only covers like 10% of the data. I have a lot data like this the line wasn't as generalize solution as i thought it would be.
prashant singh
prashant singh 2018-1-1
@Akria Agata Yes its fine if we ignore the noisy part.

请先登录,再进行评论。

回答(2 个)

John D'Errico
John D'Errico 2018-1-1
编辑:John D'Errico 2018-1-1
UGH. If I understand you, this curve has a set of points that follow no known model, but you want to fit them, in 3-D. So this becomes an errors in variables kind of thing, but with no known model, what must be effectively a spline is the only thing that makes sense here.
I think, if I understand what you said, that those points that are not on the curve are identifiable (and can thus be segregated from the fit) have z==0. So at least you know which points do not belong on the curve.
That first part of the curve seems to be pretty linear to me. Then there is a fairly sharp break into a curved segment. And you are telling us that you now want to extrapolate that curved segment over a moderately significant distance? Sigh. Why do I want to insert Mark Twain's comments on the dangers of extrapolation here? Worse, this is also moderately noisy data?
That is, when you use a model that can fit a curved segment there, the fit at the end (and any extrapolation that you do) will be primarily based on the last few points on the curve. So if you were able to put confidence limits around the extrapolated curve near the end, they would get very wide very quickly.
Do you know where/when the break occurs?
I might also note that it LOOKS like there are linear segments on this curve. Thus the curved region even seems to be composed of approximately linear segments. I might guess that curved region is three linear segments. But finding break points, even in a piecewise linear, but continuous curve, in three dimensions, with errors in variables is not a trivial thing.
Do you know some reason why the curve appears to have vaguely linear segments? That seems to be suggested, given that is what you drew.
Did I say UGH? Is this something you need to do ONCE? Or is it something you need to do automatically for multiple sets of data? (Please don't tell me the latter is the case.)
You have not provided the data itself. That makes me worry/wonder if this is something you will be doing multiple times. (Edit: oops, I see you did attach the data!)
For example, if I were needing to do this ONCE, I might artificially pick the breaks by eye. Once I had those points, I could at least use the last segment to fit a straight line using an SVD to do the errors in variables fit, then extrapolating that line.
  3 个评论
prashant singh
prashant singh 2018-1-1
编辑:prashant singh 2018-1-1
To view the data, please switch the dimension to
scatter3(data(:,3),data(:,1) ,data(:,2));
Also you can ignore the noisy part .. i just want to fit some curve even if it covers like 50% to 60% of data. I have a lot other data like this and i want to find some generalised solution for that
John D'Errico
John D'Errico 2018-1-1
It does not matter what variable is plotted on which axis. That does not improve the data or make the problem simpler.

请先登录,再进行评论。


Image Analyst
Image Analyst 2018-1-1
I thought I already answered this in your prior post. Basically you parameterize the 3 coordinates and do a fit, cleaning the data beforehand if desired. What was wrong with that solution, except that you didn't want the fitted red line to actually be plotted, which is an easy thing to get rid of?

类别

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