Commit 156a238e authored by Simon's avatar Simon
Browse files

added function quantity.Discrete.interpolant(), which returns the interpolant of the object.

parent ed2e8e7f
......@@ -292,6 +292,23 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete < handle & matlab.mi
end
end
function interpolant = interpolant(obj)
% get the interpolant of the obj;
if isempty(obj)
value = zeros(size(obj));
indexGrid = arrayfun(@(s)linspace(1,s,s), size(obj), 'UniformOutput', false);
interpolant = numeric.interpolant(...
[indexGrid{:}], value);
else
myGrid = obj(1).grid;
value = obj.obj2value();
indexGrid = arrayfun(@(s)linspace(1,s,s), size(obj), 'UniformOutput', false);
interpolant = numeric.interpolant(...
[myGrid, indexGrid{:}], value);
end
end
function assertSameGrid(a, varargin)
% check if all elements of a have same grid and gridName. If
% further quantites are inputs via varargin, it is verified if
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment