Problem with derivation of equation

1 回表示 (過去 30 日間)
George
George 2015 年 9 月 23 日
コメント済み: Walter Roberson 2015 年 10 月 2 日
This problem is somewhat getting a method to automatically produce a function from basically three variables, so far I couldn't get my head around it. I have 2 vectors and a quantity of MxN with, which is dependent on the x,y vectors
x=[0:1:18];
y=[0:1:2];
quantity=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;
0,0,0,0,49,73,85,86,83,78,82,67,63,59,0,0,0,0,0;
0,0,0,54,136,193,205,196,182,187,153,142,132,123,0,0,0,0,0];
I am trying to find a way to link all of them into an equation of some sorts, so when a new set of values x,y (which have values within the original x,y lengths), so I can get the same result for quantity as in the original matrix. Basically trying to figure out a way in matlab to link the x,y with the quantity as a final result.
Any idea would help
thanks in advance

採用された回答

Walter Roberson
Walter Roberson 2015 年 9 月 23 日
編集済み: Walter Roberson 2015 年 10 月 2 日

その他の回答 (1 件)

John D'Errico
John D'Errico 2015 年 9 月 23 日
help interp2
But no, you cannot have some simple equation that will interpolate the entire array, and be simple to write down. There is none.
  2 件のコメント
George
George 2015 年 10 月 1 日
Hello just a quick follow up. the interp2 function helped me to achieve the interpolation I wanted.
As you pointed out though a simple equation is not possible though if case adjusted it can provide some alternatives, for getting results by a new set of x,y values that agree with the analytical solutions.
Again thanks for the help
Walter Roberson
Walter Roberson 2015 年 10 月 2 日
interp2 is not going to produce an equation which is what you had requested. The multivariate Lagrange interpolation I linked to would be for producing an equation .
Most of the time you do not really want an equation: most of the time you want a function and interp2() can be an important component of the function.
But if you do want a function then you should look at triscatteredinterp and similar routines such as scatteredInterpolant which will produce a function that can then be evaluated at arbitrary points, or you can look at griddata() if you are wanting to interpolate a grid of values over a different grid.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by