# MATLAB: How to calculate the uncertainty of an

calculate uncertainty vectorfor loop in syms

Hello men and women,
the next problem has got me pinned down. Following an experiment I have to calculate the uncertainty of the values and of a coupple of equations, but I just can't get it right. I already calculated the mean values of the measurement data, and that went into a new vector. However, when I use the next code, I will get error after error, particularly because I can't use vectors in it. Basically, my question is:
Is there a way to use vectors for the variables in "syms" or do I have to write an all new function? Please help me and thanks in advance!
Regards,
Yuri
The example:
        T = big matrix;        s = vector;        g = 9.81;       ug = 0.01;  udeltas = 0.005;            for i=1:10            t(i)            = mean(T(i,:));            ut(i)           = std(T(i,:))/sqrt(length(T(i,:)));        end        for k=1:10            deltas(k)       = s(k) - 0.5*g*(t(k))^2;        end    syms Bm uBm g ug deltas udeltas t ut       for j=1:10          Bm(j)     = -(12/(g^2))*(deltas(j)-deltas(1))/(t(j)^4 - t(1)^4);          uBg(j)          = ug*diff(Bm,g);          uBdeltas(j)     = udeltas(j)*diff(Bm,deltas);          uBt(j)          = ut(j)*diff(Bm,t);          uBm(j)    = sqrt(uBg(j)^2 + uBdeltas(j)^2 + uBt(j)^2 + uBdeltas(1)^2);      end
And, upon running I receive the following errors:
Error in sym/subsref (line 1577) B = mupadmex('symobj::subsref',A.s,inds{:});

   syms Bm uBm g ug deltas deltas1 udeltas ubdeltas1 t t1 ut    g = 9.81;   ug = 0.01;   udeltas = 0.005;   Bm     = -(12/(g^2))*(deltas-deltas1)/(t^4 - t1^4);   uBg          = ug*diff(Bm,g);   uBdeltas     = udeltas*diff(Bm,deltas);   uBt          = ut*diff(Bm,t);   uBm    = sqrt(uBg^2 + uBdeltas^2 + uBt^2 + ubdeltas1^2);   % Create anonymous functions (DO NOT put semicolons on the ends of the statements, because you want them to print out in the command window):    fn_Bm = matlabFunction(Bm)   fn_uBg = matlabFunction(uBg)   fn_uBdeltas = matlabFunction(uBdeltas)   fn_uBt = matlabFunction(uBt)   fn_uBm = matlabFunction(uBm)
fn_Bm = @(deltas,deltas1,t,t1)-(deltas.*1.246933323357867e-1-deltas1.*1.246933323357867e-1)./(t.^4-t1.^4);
for k1 = 1:10      % PLEASE do not use ‘i’ or ‘j’ as variables or loop indices    Bm(k1) = fn_Bm(deltas(k1),deltas(1),t(k1),t(1));           .           .           .end