Complex uncertainty vector

49 views
Skip to first unread message

glad...@gmail.com

unread,
Dec 8, 2016, 10:43:09 AM12/8/16
to METAS UncLib

Hi Michael,


Is it possible to create a complex uncertainty vector that grows in size within a For loop?


For example, I am calculating frequency-dependent complex uncertainties for S-parameters. As I loop through the frequencies, I want the S-parameter vector size to increase by one each time, so I can store the frequency-dependent result in one variable. Ideally, I would like to be able to do something like this:



unc = @LinProp;

 

value   = complex(rand(10,1),rand(10,1));

u_abs   = rand(10,1);

u_angle = 10*rand(10,1)*pi/180;

 

for index = 1:length(value)

    s11(index,1) = unc(abs(value(index)),u_abs(index))*exp(1i*unc(angle(value(index)),u_angle(index)))

end

 


Thanks,

Jimmy

Michael Wollensack METAS

unread,
Dec 12, 2016, 7:39:39 AM12/12/16
to METAS UncLib
Hi,

> Is it possible to create a complex uncertainty vector that grows in size within a For loop?
No you have to pre-allocate the variable, see below.

unc = @LinProp;

value   = complex(rand(10,1),rand(10,1));

u_abs   = rand(10,1);

u_angle = 10*rand(10,1)*pi/180;


s11 = unc(zeros(length(value),1));

for index = 1:length(value)

    s11(index,1) = unc(abs(value(index)),u_abs(index))*exp(1i*unc(angle(value(index)),u_angle(index)))

end


Hope this helps.

Regards
Michael
Reply all
Reply to author
Forward
0 new messages