声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1663|回复: 3

[编程技巧] 谁知道这个函数

[复制链接]
发表于 2007-5-18 22:48 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
vanderrow()
查了很多地方,都没查到....
回复
分享到:

使用道具 举报

发表于 2007-5-19 08:30 | 显示全部楼层
matlab中好像没有查到。不知道你是从哪得知?
 楼主| 发表于 2007-5-19 11:09 | 显示全部楼层
这是别人编的程序,关于曲面拟合的,看不懂 帮我看看有没有错误 ,那个函数可能是写错了
clear;close;
m=3;n=3;p=1;
x=[0 4 8 12 16 20 24 28 32 36];y=[1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1];
[xx,yy]=meshgrid(x,y);
zz=[17.162 17.278 17.409 17.407 17.493 17.503 17.415 17.196 16.853 16.431
    15.889 15.995 16.097 16.096 16.171 16.181 16.101 15.906 15.405 15.241
    14.651 14.734 14.823 14.822 14.887 14.900 14.825 14.650 14.211 14.076
    13.458 13.520 13.598 13.597 13.642 13.647 13.577 13.442 13.061 12.933
    12.288 12.341 12.400 12.399 12.136 12.413 13.378 12.261 11.911 11.832
    11.153 11.199 11.239 11.239 11.268 11.269 11.218 11.116 10.681 10.763
    10.052 10.083 10.117 10.117 10.140 10.134 10.097 10.009 9.801  9.725
    8.985  9.013  9.033  9.033  9.050  9.047  9.014  8.939  8.785  8.719
    7.962  7.980  7.996  7.995  7.999  7.991  7.960  7.915  7.801  7.736
    6.964  6.973  6.987  6.987  6.987  6.983  6.954  6.919  6.842  6.794];

function [SZ]=fit surface(m,n,p,xx,yy,zz)
%m,n are polynomial order, p weighting matrix
close all
X=vanderrow(m);
Y=vanderrow(n);
Y=subs(Y,'x','y');
SXY=X*transpose(Y);
%weighting W
W=ones(m+1,n+1);
XY=SXY.*W;
XY=transpose(SXY(:));
XY=XY(2:length(XY));
%get all coefficients
a=1;
x=xx(:);
Y=YY(:);
z=zz(:);
XY=double(subs(XY));
XY=[ones(length(x).1).XY];
A=pinv(XY)*z.^p;
a=reshape(A,m+1,n+1);
SZ=SXY.*a;
%the symbolic bivariable polynomial to be got by fit
SZ=sum(SZ(:));
%draw a original surface
figure
subplot(2,2,1);
surf(xx,yy,zz);
%colormap([0 0 0]);
title('original surface')
%draw the fit surface
x=xx;y=yy;
fZ=double(subs(SZ));
figure
subplot(2,2,2);
surf(x,y,fZ);
%colormap([0 0 0]);
title('fit surface')
view(3)
发表于 2007-5-19 11:13 | 显示全部楼层
原帖由 red427 于 2007-5-19 11:09 发表
这是别人编的程序,关于曲面拟合的,看不懂 帮我看看有没有错误 ,那个函数可能是写错了
clear;close;
m=3;n=3;p=1;
x=[0 4 8 12 16 20 24 28 32 36];y=[1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1];
[xx,yy]= ...


估计是自定义的函数,非 matlab 默认的函数,建议自己再找找
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-7-5 15:20 , Processed in 0.066506 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表