surface fitting
11 ビュー (過去 30 日間)
古いコメントを表示
I am using MATLAB 2007. I want to do surface fitting. Any help will be appreciated.
Thanks.
0 件のコメント
採用された回答
Grzegorz Knor
2011 年 11 月 29 日
See:
You can also write your own function e.g. by using the Optimization Toolbox.
0 件のコメント
その他の回答 (7 件)
Grzegorz Knor
2011 年 11 月 29 日
Add folder which contains this function to search path, and type:
help gridfit
0 件のコメント
Grzegorz Knor
2011 年 11 月 30 日
Gridfit produce only smooth surface that approximates your data.
If you want to calculate the coefficient c from your model look at the example:
[x y] = meshgrid(-1:.1:1);
c = sqrt(2);
z = c*( 2*(x.^2+y.^2)-1 );
z = z + randn(size(z))/5;
plot3(x,y,z,'r.')
f = @(c)norm(z-c*( 2*(x.^2+y.^2)-1));
c1 = fminsearch(f,1);
z1 = c1*( 2*(x.^2+y.^2)-1 );
hold on
surf(x,y,z1,'FaceColor','none')
0 件のコメント
smp
2011 年 11 月 30 日
1 件のコメント
Grzegorz Knor
2011 年 11 月 30 日
If z is a vector, then x and y should be vectors too.
BTW: add dots to this line before ^:
f = @(c)norm(z-c*(2*(x.^2+y.^2)-1))
smp
2011 年 12 月 1 日
2 件のコメント
Walter Roberson
2011 年 12 月 1 日
See the reference material for mpower ("^") and power (".^") to see when to use one or the other.
Changing the initial value of c to 5 has no effect on the code. The anonymous function f does not use the existing value of c in any way. The anonymous function uses c as a "dummy argument". Nothing would change if you were to instead use
f = @(ThisC)norm(z-ThisC* (2*(x.^2+y.^2)-1 ) )
参考
カテゴリ
Help Center および File Exchange で Get Started with Curve Fitting Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!