找回密码
 注册
Simdroid-非首页
查看: 153|回复: 3

Matlab R2007a 没有了smooth命令?

[复制链接]
发表于 2008-4-7 11:44:17 | 显示全部楼层 |阅读模式 来自 美国
help smooth了一下,找不到了。不知道这样的命令是什么?
我要解决的问题是:试验测到 y=f(x) 曲线,不光滑,有峰值,但理论上是光滑的。所以想过滤,或者平滑曲线。
发表于 2008-4-7 22:16:22 | 显示全部楼层 来自 浙江杭州
Simdroid开发平台
是不是你用的matlab安装有问题?这个命令应该一直在的。我用2008a试了一下有的阿,另外看了release notes 没有说smooth命令有过改变。

help smooth
SMOOTH  Smooth data.
    Z = SMOOTH(Y) smooths data Y using a 5-point moving average.

    Z = SMOOTH(Y,SPAN) smooths data Y using SPAN as the number of points used
    to compute each element of Z.

    Z = SMOOTH(Y,SPAN,METHOD) smooths data Y with specified METHOD. The
    available methods are:

            'moving'   - Moving average (default)
            'lowess'   - Lowess (linear fit)
            'loess'    - Loess (quadratic fit)
            'sgolay'   - Savitzky-Golay
            'rlowess'  - Robust Lowess (linear fit)
            'rloess'   - Robust Loess (quadratic fit)

    Z = SMOOTH(Y,METHOD) uses the default SPAN 5.

    Z = SMOOTH(Y,SPAN,'sgolay',DEGREE) and Z = SMOOTH(Y,'sgolay',DEGREE)
    additionally specify the degree of the polynomial to be used in the
    Savitzky-Golay method. The default DEGREE is 2. DEGREE must be smaller
    than SPAN.

    Z = SMOOTH(X,Y,...) additionally specifies the X coordinates.  If X is
    not provided, methods that require X coordinates assume X = 1:N, where
    N is the length of Y.

    Notes:
    1. When X is given and X is not uniformly distributed, the default method
    is 'lowess'.  The 'moving' method is not recommended.

    2. For the 'moving' and 'sgolay' methods, SPAN must be odd.
    If an even SPAN is specified, it is reduced by 1.

    3. If SPAN is greater than the length of Y, it is reduced to the
    length of Y.

    4. In the case of (robust) lowess and (robust) loess, it is also
    possible to specify the SPAN as a percentage of the total number
    of data points. When SPAN is less than or equal to 1, it is
    treated as a percentage.

    For example:

    Z = SMOOTH(Y) uses the moving average method with span 5 and
    X=1:length(Y).

    Z = SMOOTH(Y,7) uses the moving average method with span 7 and
    X=1:length(Y).

    Z = SMOOTH(Y,'sgolay') uses the Savitzky-Golay method with DEGREE=2,
    SPAN = 5, X = 1:length(Y).

    Z = SMOOTH(X,Y,'lowess') uses the lowess method with SPAN=5.

    Z = SMOOTH(X,Y,SPAN,'rloess') uses the robust loess method.

    Z = SMOOTH(X,Y) where X is unevenly distributed uses the
    'lowess' method with span 5.

    Z = SMOOTH(X,Y,8,'sgolay') uses the Savitzky-Golay method with
    span 7 (8 is reduced by 1 to make it odd).

    Z = SMOOTH(X,Y,0.3,'loess') uses the loess method where span is
    30% of the data, i.e. span = ceil(0.3*length(Y)).

    See also spline.

    Reference page in Help browser
       doc smooth

评分

1

查看全部评分

回复 不支持

使用道具 举报

 楼主| 发表于 2008-4-7 23:11:31 | 显示全部楼层 来自 美国

回复 2# 的帖子

谢谢!
不过我记得安装好像没有问题。我再看看。
回复 不支持

使用道具 举报

发表于 2008-4-27 00:41:47 | 显示全部楼层 来自 上海浦东新区
如果只是想平滑曲线,也可以用filter函数

You can use filter to find a running average without using a for loop. This example finds the running average of a 16-element vector, using a window size of 5.

data = [1:0.2:4]';
windowSize = 5;
filter(ones(1,windowSize)/windowSize,1,data)

其实smooth内部就是用filter来实现的

评分

1

查看全部评分

回复 不支持

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2026-1-7 23:10 , Processed in 0.032377 second(s), 20 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2025 Discuz! Team.

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