Unc matrix from Excel file

49 views
Skip to first unread message

sle...@gmail.com

unread,
Jul 19, 2021, 10:25:22 AM7/19/21
to VNA Tools
Hi Michael,

I read frequency, measurement result of R&S NRP-Z51 power sensor and standard uncertainty from excel file to MatLab.

How can I create an uncertainty object matrix from them, (the measurement results are independent from each other).

This is the code:
clear all;
echo on;
 
%% --- LinProp ---
% define function handle for LinProp
unc = @LinProp;
 
% R&S NRP-Z51 measurmet result and uncertanity read from excel file
T = readtable('BS_17300_2_2019_BIRD_4022_10368_csak_40dB.xlsx','Sheet','Forward direction 40dB S kor','Range','A6:A27');
f = table2array(T);
T = readtable('BS_17300_2_2019_BIRD_4022_10368_csak_40dB.xlsx','Sheet','Forward direction 40dB S kor','Range','D6:D27');
Xenrp_dBm = table2array(T);
T = readtable('BS_17300_2_2019_BIRD_4022_10368_csak_40dB.xlsx','Sheet','Forward direction 40dB S kor','Range','AE6:AE27');
Xenrp_Std = table2array(T);
 
Xenrp = unc([Xenrp_dBm], [Xenrp_Std]);

I got error message:

Error using LinProp (line 110)
Message: Az index a tömb határain kívülre mutatott. (The index pointed beyond the boundaries of the array.)
Source: Metas.UncLib.Core
HelpLink:

Error in BIRD_4022 (line 16)
Xenrp = unc([Xenrp_dBm], [Xenrp_Std]);

Regards,
László

Dion Timmermann

unread,
Jul 20, 2021, 1:19:16 AM7/20/21
to VNA Tools
Hi László,

I think I can also help.

The syntax you are using would work if Xenrp_dBm and Xenrp_Std were scalars. For vectors you need to pass the covariance matrix instead of the standard deviation.

Since your measurements results are independent from each other, you could initialize each element separately:
> Xenrp = unc(zeros(size(Xenrp_dBm)));
> for ii = 1:numel(Xenrp_dBm)
>     Xenrp(ii) = unc(Xenrp_dBm(ii), Xenrp_Std(ii));
> end

Or you could create the vector with a diagonal covariance matrix. Not that you must take the square of the standard deviations. This method should be faster, as it has less overhead.
> Xenrp = unc(Xenrp_dBm, diag(Xenrp_Std.^2));

Regards,
    Dion

sle...@gmail.com

unread,
Jul 20, 2021, 3:14:18 AM7/20/21
to VNA Tools
Hi Dion,

Thank you for your answer, it works.

Regeards,
László
Reply all
Reply to author
Forward
0 new messages