gendatlin.m
来自「模式识别工具箱。非常丰富的底层函数和常见的统计识别工具」· M 代码 · 共 51 行
M
51 行
%GENDATLIN Generation of linear regression data%% A = GENDATLIN(N,B0,B1,SIGMA)%% INPUT% N Number of objects to generate% B0 Offset% B1 Slope% SIGMA Standard deviation of the noise%% OUTPUT% A Regression dataset%% DESCRIPTION% Generate regression data A, containing N (x,y)-pairs according to :% y = B0 + B1^T*x + N(0,SIGMA)% Data x is distributed uniformly between 0 and 1.%% SEE ALSO% GENDATSIN, 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 a = gendatlin(n,b0,b1,sig)if nargin<4 sig = 0.1;endif nargin<3 b1 = -1;endif nargin<2 b0 = 2;endif nargin<1 n = 25;end% check the size of beta1b1 = b1(:);dim = size(b1,1);% generate the data:x = rand(n,dim);y = x*b1 + b0 + sig(1).*randn(n,1);% store it in the dataset:a = gendatr(x,y);return
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?