| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 716 人关注过本帖
标题:英语好的matlab达人请进
只看楼主 加入收藏
gundamnacl
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2007-9-5
收藏
 问题点数:0 回复次数:0 
英语好的matlab达人请进
一道题,如题所要求,在线形回归时,不能用polyval或其他function
You are required to write a program (MATLAB function) that fits a polynomial to a set of
data. Your programme should use the MATLAB command ”polyfit”, however, it should not
use any other built-in polynomial fitting MATLAB functions (such as ”spline”). The call to
the finished function should look like:
[poly, bounds] = linefit(data, norm)
where poly is a row vector of elements pi corresponding to the coefficients of xi in a polynomial
function for y: i.e.
y = p0 + p1x + p2x2 + ...pnxn (1)
bounds = [xmin, xmax] is a vector defining the bounds of the fit (based on the bounds of
the data set). data is data set in the form of a vector of x,y pairs, thus:
data = [x1, y1; x2, y2; ; xn, yn];
and norm takes the string values ’max’ and ’lse’ for maximum norm and least-squares error
norm respectively. The ’max’ norm defines the ’distance’ between the curve fit and the original
data to be the maximum distance between the fitted curve and the curve that results from
fitting a straight line between each successive pair of data points. The ’lse’ norm defines the
’distance’ between the curve fit and the original data to be the total (root-mean squared) area
2
enclosed between the fitted curve and the curve that results from fitting a straight line between
each successive pair of data points.
Your function should find the polynomial of least degree which is best fitted to the data
set under the specified norm: that is, the curve which minimises the ’distance’ between the
polynomial fitted curve and the linear fitted curve as specified by either ’max’ or ’lse’.
You should write a second function disp line(pp, bounds, data) which displays (including
plotting) the results of the fit in an easy to read and understand form.
搜索更多相关主题的帖子: 英语 matlab 
2007-09-05 19:30
快速回复:英语好的matlab达人请进
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.026928 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved