gendatsin.m
来自「这是模式识别方面的电子书籍」· M 代码 · 共 49 行
M
49 行
%GENREGSIN Generate sinusoidal regression data%% X = GENDATSIN(N,SIGMA)%% INPUT% N Number of objects to generate% SIGMA Standard deviation of the noise%% OUTPUT% X Regression dataset%% DESCRIPTION% Generate an artificial regression dataset [X,Y] with:%% y = sin(4x) + noise. %% where noise is Gaussian distributed with standard deviation sigma.%% X = GENDATSIN(100)% generates 100 x,y pairs with data and default noise (sigma = 0.1).%% x = (0:0.01:1)';% y = genregsin(x,0);% generates the true function along the x-axis, with zero noise.%% SEE ALSO% GENDATR, GENDATSINC% Copyright: D.M.J. Tax, D.M.J.Tax@prtools.org% Faculty EWI, Delft University of Technology% P.O. Box 5031, 2600 GA Delft, The Netherlandsfunction x = gendatsin(nrx,noise)if nargin<2 noise = 0.1;endif (length(nrx)>1) x = nrx; nrx = size(x); x = sin(4*x) + noise*randn(nrx);else x = rand(nrx,1); y = sin(4*x) + noise*randn(nrx,1);endx = gendatr(x,y);return
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?