?? copyendpoints.m
字號(hào):
function [begx, begy, endx, endy] = copyendpoints(x, y, datay, type)
% The function COPYENDPOINTS returns extrema endpoints and their coordinates.
% It copies endpoints of extrema and makes sure that
% spline encompasses dataset, and extrema are outside of the bounds
% of the original data, to prevent errors in creating the envelope.
%
% Calling sequence-
% [begx, begy, endx, endy] = copyendpoints(x, y, datay, type)
%
% Input-
% x -the x coordinates of the extrema
% y -the y values of the extrema
% datay -the original dataset from which the extrema values
% come from
% type -equals -1 if extrema are minimum extrema,
% equals 1 if they are maximum extrema
% Output-
% begx -the x values for the beginning extrema endpoints
% begy -the y values for the beginning extrema endpoints
% endx -the x values for the end extrema endpoints
% endy -the y values for the end extrema endpoints
%
% Used by-
% NFAM5M
% Karin Blank (NASA GSFC) May 5, 2003 Initial
%----- Initialize the distance
if(length(x) > 1)
delta_x = x(2) - x(1);
else
delta_x = x(1);
end
%----- Make sure distances are greater than the distance to data end
if((x(1) - delta_x) > 0)
delta_x = x(1);
end
y_can = y(1);
if(type == 1)
%----- Make sure extrema is greater than original data
if((y_can < datay(1)))
y_can = datay(1);
end
else
if((y_can > datay(1)))
y_can = datay(1);
end
end
if(length(x) > 1)
delta_x2 = x(end) - x(end-1);
else
delta_x2 = length(datay)-x(end);
end
if((delta_x2 + x(end)) < length(datay))
delta_x2 = length(datay) - x(end);
end
y_can2 = y(end);
if(type==1)
if(y_can2 < datay(end))
y_can2 = datay(end);
end
else
if(y_can2 > datay(end))
y_can2 = datay(end);
end
end
begx = x(1)-delta_x;
begy = y_can;
endx = x(end)+delta_x2;
endy = y_can2;
for i=1:4
begx = [begx(1)-delta_x, begx ];
begy = [y_can, begy];
endx = [endx, endx(end)+delta_x2];
endy = [endy, y_can2];
end
return;
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -