- #1

- 380

- 7

**Homework Statement**I have a few data-analysis problems due to Thursday,

**1.**Assume that a sandbag is dropped at different heights and the observations are (z

_{i};t

_{i}) pairs. Physical model for a free fall is z=½gt

^{2}. Assume that the height measurement z has an additive random error v. The observation model is then z=h(θ;t) +v,where θ is the unknown parameter vector. Write the observation models (withpaper and pen) for the following cases by treating systematic errors as model parameters:

**a)**height z has a systematic error z

_{0 }(z

_{obs}=z

_{real}+z

_{0})

**b)**falling time thas a systematic error t

_{0}(tobs=treal+t0)

**c)**both z and t have additive systematic errors. Simulate results by using Matlab for graphic presentation.

**2.**Assume that a sandbag is dropped at different heights and the observations are (zi,ti)pairs. It’s known that the clock advances p percents, but the clock can be considered precise (no random error for t). In addition, assume that the height z has a systematic error z

_{0}. Write the (linear) observation model withpaper and pen. How would you solve a value for g by using the model?

**Simulate with**

4.

4.

Matlab the distributions of:

y1=sin(x)

y2=cos(x)

y3=log(x)

when x is uniformly distributed between [−π, π] in Eq. (1) and in Eq. (2), and uniformly distributed

between [1,2] in Eq. (3).

**5.**The second order polynomial function is of the form

y=p(1)x2+(2)x+p(3). The exact roots of the polynomial are x

_{1}=1 and x

_{2}=2. For some reason, there is a uniformly distributed error in the observed polynomial coefficients p(1), p2) and p(3). Here, we examine the distribution of observed roots in that case. (Matlab simulation)

**a)**Solve the exact polynomial coefficients p(1), p(2) and p(3) (command poly) and plot the polynomial y

in range x∈[−1,...,4] (command polyval)

**b)**Generate N= 5000 observations for polynomial coefficients with uniformly distributed noise.

Solve the roots for each observation (command roots).

**c)**Plot a histogram of observed roots x

_{1}and x

_{2}

**The attempt at a solution****z=h(θ;t) +v +z**

1.

a.)

1.

a.)

_{0}

**b.)**z=h(θ;t+t

_{0}) +v

**c.)**z=h(θ;t+t

_{0}) +v+z

_{0}

**%% Problem 1/a**

g=10; % gravity constant

h_err=2; % systematic error of height

t=[0.3 0.5 0.7 1 2 2.5 3 3.7 3.8 4]';

tt=[0:.1:4]';

h=0.5*g*t.^2 + h_err + 10*randn(size(t));

H=[0.5*t.^2 ones(size(t))];

th=H\h

HH=[0.5*tt.^2 ones(size(tt))];

figure(1),clf

plot(t,h,'+',tt,HH*th)

xlabel 't'

ylabel 'h'

**%% Problem 1/b**

g=10; % gravity constant

t_err=2; % systematic error of time

t=[0.3 0.5 0.7 1 2 2.5 3 3.7 3.8 4]';

tt=[0:.1:4]';

h=0.5*g*(t+t_err).^2 + 10*randn(size(t));

H=[0.5*t.^2 ones(size(t))];

th=H\h;

HH=[0.5*tt.^2 ones(size(tt))];

figure(2),clf

plot(t,h,'+',tt,HH*th)

xlabel 't'

ylabel 'h'

%% Problem 1/c

%% Problem 1/c

g=10; % gravity constant

h_err=2; % systematic error of height

t_err=0;5; % systematic error of time

t=[0.3 0.5 0.7 1 2 2.5 3 3.7 3.8 4]';

tt=[0:.1:4]';

h=0.5*g*(t+t_err).^2 + h_err + 10*randn(size(t));

H=[0.5*t.^2 ones(size(t))];

th=H\h;

HH=[0.5*tt.^2 ones(size(tt))];

figure(3),clf

plot(t,h,'+',tt,HH*th)

xlabel 't'

ylabel 'h'

**%% Problem 2**

g=10; % gravity constant

t_err=0;01*t; % systematic error of time, e.g.clock is advancing one percent

t=[0.3 0.5 0.7 1 2 2.5 3 3.7 3.8 4]';

tt=[0:.1:4]';

h=0.5*g*(t+t_err).^2 + h_err;

H=[0.5*t.^2 ones(size(t))];

th=H\h

HH=[0.5*tt.^2 ones(size(tt))];

figure(4),clf

plot(t,h,'+',tt,HH*th)

xlabel 't'

ylabel 'h'

**%% Problem 4**

x_1=unifdist(-pi,pi,2,1);

y_1=sin (x_1);

y_2=cos (x_1);

x_3=unifdist(1,2,2,1);

y_3=log (x_3);

I will appreciate any help as I am not very familiar with matlab yet \\ could sb please check what I've done so far

p.s. not sure if this is the right forum section for matlab-based questions

Last edited: