フィルターのクリア

How to do 2D surface fitting regression ?

5 ビュー (過去 30 日間)
Haider al-kanan
Haider al-kanan 2016 年 5 月 26 日
コメント済み: Image Analyst 2016 年 5 月 27 日
I have data x, y are 2 independant variables , x is vector data 1x200, y is vector data 1x5, z is dependant variable which is matrix data dim 5x200. I am trying to fit polynomail surface to the given data in the form Z = p00 + p10*x + p01*y + p20*x.^2 + p11*x*y + p30*x.^3 + p21*x.^2*y since the variables dimension don't match , I got error when using the least error method to estimate the coffiecients P P=[1 x y x.^2 x*y x.^3 x.^2*y]\Z how to solve that? and represent it in matrix forms?
  2 件のコメント
Ahmet Cecen
Ahmet Cecen 2016 年 5 月 27 日
There is something wrong with the way you are setting up the problem. You cannot have independent variables with different dimensions for a regression problem. If x has 200 observations, y also needs to have 200 observations (not necessarily unique).
Image Analyst
Image Analyst 2016 年 5 月 27 日
He'd need to use meshgrid
[allX, allY] = meshgrid(x, y);
and then make sure the Z are associated with the correct coordinate. Or better yet, just start with a 5x200 image of Z. Then he can use polyfitn() like in my answer below.

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

回答 (1 件)

Image Analyst
Image Analyst 2016 年 5 月 26 日
I've attached a demo where I use it to do background correction.

カテゴリ

Help Center および File ExchangeLinear and Nonlinear Regression についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by