binden.m
来自「patten regnization source从1-14章能运行」· M 代码 · 共 26 行
M
26 行
function [xb,cb]=binden(n,x)% ----------------------------------------------------------------% function [xb,cb]=binden(n,x)% ----------------------------------------------------------------% Given a 1-dimensional data set this function% devides the space into n bins and calculates bin counts. %% ------------------------------------------------------------------% INPUT% n number of bins % x data, row vector % OUTPUT% xb bin centers. xb(i) center of bin_i% cb bin counts. cb(i)=#j, where x_j's in Bin_i %------------------------------------------------------------------- xmax=max(x);xmin=min(x);binwidth=(xmax-xmin)/(n);for i=1:n xb(i)=binwidth*(i-0.5)+xmin; % bincenterendcb=hist(x,xb);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?