How to use matrix functions from MATLAB on larger arrays?

54 views
Skip to first unread message

Karsten Kuhlmann PTB

unread,
Aug 24, 2016, 6:02:51 AM8/24/16
to METAS UncLib

Hello


If one wants to use matrix functions from MATLAB like det() or inv() on a matrix of type unc.lin, they usually work. Also if you have a subarray of a 3D matrix, but unfortunately not for a subarray of a 4D matrix:
s2=unc(rand(2,2));
s3=unc(rand(2,2,3));
s4=unc(rand(2,2,3,4));
inv(s2)
inv(s3(:,:,1))
inv(s4(:,:,1,1))
Is there a way to work with larger arrays, without losing the uncertainty chain (e.g. applying get_value and get_stdunc to build a new matrix)?


Greetings, Karsten

Karsten Kuhlmann PTB

unread,
Aug 24, 2016, 7:47:08 AM8/24/16
to METAS UncLib
I found a way around by using cell arrays:
s4{4}=unc(rand(2,2,3));
s4{3}=unc(rand(2,2,3));
s4{2}=unc(rand(2,2,3));
s4{1}=unc(rand(2,2,3));

Greetings, Karsten

Michael Wollensack METAS

unread,
Aug 29, 2016, 4:15:38 AM8/29/16
to METAS UncLib
Hi Kartsen,

this is another workaround:
inv(reshape(s4(:,:,1,1),[2,2]))

the problem is:
>> size(s4(:,:,1,1))

ans =

     2     2     1

Regards
Michael
Reply all
Reply to author
Forward
0 new messages