How to predict the function in two variables?
显示 更早的评论
I want to generate a function in two independent variables f (t, X) . I have the data of f at some particular t and X.(Like @t=0.33 , t=0.67,t=1 I have the values for all x, similarly at x=0.2,0.4,0.6,0.8 I have f for all t). To make it simple i have the f data in a matrix with rows as t and columns as x .


So with my limited data i want to predict the value of f at other points by some methods.
Further this plot is f vs x at cont t, similarly I have data for f vs t at const x. So I want to combine all these data to be able to get an approximate function f(x,t).
As some of you wanted to have a look at the data I am attaching the data along with this.
I have a gut feeling this is a trivial question and there exist no unique answer and i had a look at documentation for regression and optimisation but those seem to be too complex for me to understand.
3 个评论
Andrew Newell
2020-6-6
Just to clarify - you have the data for the three curves shown and you want to predict values for the entire region of the plot?
Susmit Kumar Mishra
2020-6-7
编辑:Susmit Kumar Mishra
2020-6-7
John D'Errico
2020-6-8
编辑:John D'Errico
2020-6-8
As I show in my second answer, your gut feeling is wrong, because your data is not self consistent. There can be no trivial solution. Even if you look for a more sophisticated solution, no solution will exist until you fix your data.
采纳的回答
更多回答(1 个)
John D'Errico
2020-6-6
编辑:John D'Errico
2020-6-6
0 个投票
Actually, probably not that. It appears there are three curves, each representing f(x), at ONE specific value of t. There are three curves shown, so three values for t.
So it is not the entire region of the plot that needs to be predicted. In fact, it appears the data seem to fill a rectangle in the (x,t) plane, though not very well in t. Really, the common way to plot this relation is as a surface f(x,t). The data is, as i say, sufficient for that, although it will be quite simple as a function of t.
Assuming I am correct, and I feel moderately confident in that claim, then a simple solution is just interp2. I lack your data, so I cannot really show how to do it. Just read the help and look at the examples for interp2. Alternatively, you could use griddedInterpolant, which will offer a function that you can simply evaluate at any point or set of points.
My question is if you feel you need a functional relationship you can write down on paper. I'm not sure why, but this often seems to be important to people. In that case, you really don't have sufficient information defining the total surface to build any model, especially since you don't seem to have offered any candidate models for the overall process.
A polynomial surface MIGHT be adequate here. That is, you MIGHT find that if a cubic polynomial is sufficient to model each of those simple functions of x at any specific level of t, then you could think of the coefficients of the cubic polynomials as at most quadratic functions of t. However, without your data to look at more seriously, this is difficult to know. If you want better help, then attach your data to a comment or to your question.
1 个评论
Susmit Kumar Mishra
2020-6-7
编辑:Susmit Kumar Mishra
2020-6-8
类别
在 帮助中心 和 File Exchange 中查找有关 Linear and Nonlinear Regression 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

