📄 stairintegr.m
字号:
function [ival] = stairintegr(jptimes, fval, startv)
%
% STAIRINTEGR Integrate piecewise constant (stair) functions. The results
% are piecewise linear functions.
% Both the piecewise constant and piecewise linear functions are stored
% in two matrices containing the jump or break points and function
% values at these points respectively. If they have different number of
% jumps, each vector is padded with the last value to have the same
% length. All functions are assumed to be right-continuous.
%
% [ival] = stairintegr(jptimes, fval [, startv])
%
% Inputs:
% jptimes - a matrix of the jump times stored columnwise
% fval - a matrix of function values at the jump points stored
% columnwise
% startv - optional; start value to add to the integral;
% a row vector with length equal to size(jptimes, 2). The
% default value is zeros(1, size(jptimes, 2)).
%
% Outputs:
% ival - a matrix of the values of the integral at the jump
% points. The matrix of break points is equal to jptimes.
%
% See also STAIRCUT, STAIRSUM.
% Authors: R.Gaigalas, I.Kaj
% v2.0 17-Oct-05
% start value is zero if omitted
if (nargin==2)
startv = zeros(1, size(jptimes, 2));
end
% for the linear function F=Int(f) we have delta_F=f(x)*delta_x
ival = cumsum([startv; fval(1:end-1, :).*diff(jptimes)]);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -