How to Fit Tabular Data

12 ビュー (過去 30 日間)
Christopher Dottellis
Christopher Dottellis 2021 年 1 月 19 日
回答済み: Nitin Kapgate 2021 年 2 月 9 日
I have a table with two variables, x and y. For each x,y pair there is a z.
I'm trying to find a two variable function that can represent this table. I have been trying to use fit() but it says that the format of my vectors is off. So I did the example and looked at the three vectors loaded in.
load franke;
surffit = fit([x,y],z,'poly23','normalize','on')
I find that the vectors , x, y, and z are all the same dimension. However, in my mind z = f(x,y) should be a matrix of values with dimensions size(x) by size(y). What is this fit function actually fitting then?
  1 件のコメント
Christopher Dottellis
Christopher Dottellis 2021 年 1 月 19 日
To clarify, this data is sparse. Might it just be easier to create the function by hand?

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

回答 (1 件)

Nitin Kapgate
Nitin Kapgate 2021 年 2 月 9 日
'z' vector should be of the same size as 'x' and 'y' vectors. The fit function tries to approximately fit a curve or surface to the data using different fitting techniques (fit type) etc.
You can refer to this example that demonstrates how to fit a surface using variables in a MATLAB Table.

カテゴリ

Help Center および File ExchangeGet Started with Curve Fitting Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by