Commit 5ee5a6e5 authored by Ferdinand Fischer's avatar Ferdinand Fischer
Browse files

Fixed quantity.Symbolic/int

parent acbe8f5d
...@@ -744,36 +744,7 @@ classdef Symbolic < quantity.Function ...@@ -744,36 +744,7 @@ classdef Symbolic < quantity.Function
'name', "{" + obj(1).name + "}^{H}", ... 'name', "{" + obj(1).name + "}^{H}", ...
'domain', obj(1).domain); 'domain', obj(1).domain);
end % expm() end % expm()
function C = int(obj, z, a, b)
% from help sym/int:
% "int(S,v,a,b) is the definite integral of S with respect to v
% from a to b."
if nargin == 2
grdIdx = obj(1).domain.gridIndex(z);
a = obj(1).grid{grdIdx}(1);
b = obj(1).grid{grdIdx}(end);
end
if nargin == 3
b = a;
a = z;
z = num2cell( obj(1).variable );
end
if nargin == 1
assert(obj.nargin == 1, 'Not Implemented')
z = obj(1).grid{1};
a = z(1);
b = obj.variable;
z = num2cell( obj(1).variable );
end
C = obj.cumInt(z, a, b);
end % int()
function C = cumInt(obj, domain, lowerBound, upperBound) function C = cumInt(obj, domain, lowerBound, upperBound)
% CUMINT cumulative integration % CUMINT cumulative integration
% result = cumInt(obj, domain, lowerBound, upperBound) % result = cumInt(obj, domain, lowerBound, upperBound)
......
...@@ -112,7 +112,7 @@ classdef SignalModel ...@@ -112,7 +112,7 @@ classdef SignalModel
end end
methods (Static) methods (Static)
function sm = constant(varargin) function sm = constant(varargin)
S = 0; S = 0;
p = 1; p = 1;
......
...@@ -132,6 +132,18 @@ fFlipped2 = f.flipGrid({'z', 'zeta'}); ...@@ -132,6 +132,18 @@ fFlipped2 = f.flipGrid({'z', 'zeta'});
tc.verifyEqual(fReference2.on, fFlipped2.on, 'AbsTol', 10*eps); tc.verifyEqual(fReference2.on, fFlipped2.on, 'AbsTol', 10*eps);
end % testFlipGrid(); end % testFlipGrid();
function testInt(testCase)
t = sym('t');
T = quantity.Domain.defaultDomain(10, 't');
f = quantity.Symbolic(sin(t), 'domain', T);
F = int(f);
testCase.verifyEqual(F, double( int( sin(t), t, 0, 1 ) ), 'AbsTol', 6e-17);
end
function testCumInt(testCase) function testCumInt(testCase)
tGrid = linspace(pi, 1.1*pi, 51)'; tGrid = linspace(pi, 1.1*pi, 51)';
sGrid = tGrid; sGrid = tGrid;
......
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