0
Under review

It is possible to use mp computations in a simulink block or S-function ?

JLD95 5 months ago updated by Pavel Holoborodko 5 months ago 1

I would like a simulink block which have double precision floating point in input and output but internal computations in this block are made in quadruple precision: it is possible to use with MP Toolbox ?

Under review

This is definitely possible with usual MATLAB functions, e.g.:

function F = mpfun(x)
        x = mp(x)      % convert input to 'mp'
        ...            % compute F using 'mp'
        F = double(F)  % return 'double'
end

S-function is complied MEX module and it cannot use "mp" objects directly in C/C++ code.

But you can put 'mp'-related code to separate MATLAB function (like above) and call it from within MEX/S-function using mexCallMATLABWithTrap or mexCallMATLAB.