📄 rangenew.m
字号:
%#
%# function [rdata] = rangenew(data,mn,mx,table)
%#
%# AIM: Each element in the new data set is scaled to a range determined
%# by the user on a reference set.
%#
%# PRINCIPLE: The new set is scaled so that its extrema match the extrema determined
%# on a reference set (e.g. a training set).
%#
%# Reference :
%# M.A.Sharaf, D.L.Illman, B.R.Kowalski, "Chemometrics"
%# Wiley & Sons, Chichester, UK (1986)
%#
%# INPUT: data (mt*n) : New set to scale (Can be column-vector, row-vector or
%# matrix).
%# mn : Minimum of the new range.
%# mx : Maximum of the new range.
%# table (1*2) : Row vector containing the minimum and maximum values of
%# the reference set.
%#
%# OUTPUT: rdata (mt*n) : Range-scaled set.
%#
%# AUTHOR: Frederic Despagne
%# Copyright(c) 1998 for ChemoAC
%# Dienst FABI, Vrije Universiteit Brussel
%# Laarbeeklaan 103, 1090 Jette
%#
%# VERSION: 1.1 (28/02/1998)
%#
%# TEST: Andrea Candolfi
%#
function [rdata] = range(data,mn,mx,table)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SCALING PARAMETERS %%%%%%%%%%%%%%%%%%%%%%%%%
[mt,n] = size(data); % Size of new set
rn = mx-mn; % New range
xmn = table(1); % Minimum of the reference data set
xmx = table(2); % Maximum of the reference data set
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RANGE-SCALING OF THE NEW SET %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for i = 1:n
for j = 1:mt
rdata(j,i) = (data(j,i)-xmn)/((xmx-xmn))*rn+mn; % Range-scaling
end;
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -