Hi, Marry Christmass,
The problem was solved by a technique called object composition. Just for documenting, in the case of static method "." operator should be used. and with the superclass "@" operator. (and bunch of concepts about superiority/inferiority) ... however using direct call (some sort of overloading) was enough to have a working class:
Class A:
classdef A < matlab.system.System
properties
W % numeric properties
Func % function handle or object
end
methods
function obj = A(Func,w)
if nargin == 2
obj.W = w;
obj.Func = Func;
else
obj.W = 16;
obj.Func = @(x) sin(x);
end
end
end % method
methods (Access=protected)
function y = stepImpl(obj,x)
y = do(obj.Func,x)*obj.W;
end
function numIn = getNumInputsImpl(~)
numIn = 1;
end
end
end
Class T:
classdef T < handle
properties
N
end
methods
function obj = T(n)
if nargin == 0
obj.N = 16;
end
if nargin == 1
obj.N = n;
end
end
function y = do(obj,x)
y = abs(fft(x,obj.N));
end
end
end % method
Main Script:
clear all
clear classes
clc
x = linspace(0,10*pi,100);
a = T(100);
b = A(T,3);
step(b,x)