Académique Documents
Professionnel Documents
Culture Documents
UNIVERSITÄT FREIBURG
Prof. Dr. Leonhard Reindl
Lehrstuhl El. Mess- und Prüfverfahren
Signal Processing
Solution Exercise Nr. 2 SS2011
Date of issue: 19.05.11
Input parameter: U
Measured parameter: I
Exercise:
1) Calculate the coefficients for the straight line approximation of the measured data, and draw
the calculated line in a diagram, as well as the measured data.
I [ A] = a + b ⋅ U [V ]
N
1 N N
1 N N
∑x yn n
− ∑ xn ⋅ ∑ yn
N n =1
a= ∑ yn − ∑ xn b b = n =1N n =1
(page 2.59)
N n =1 1 N N
n =1
∑n =1
xn2 − ∑ xn ⋅ ∑ xn
N n =1 n =1
2) Smooth the series of the measurement using linear fitting with 3 points.
yn +1 + yn + yn −1
yn = (page 2.70)
3
yn +1 − yn −1
yn′ = (page 2.75)
2h
Kepler’s barrel rule (page 2.81) is applicable only for an odd number of measuring points!
yn + 4 yn +1 + yn + 2
Kn = 2 ⋅ h ⋅ with n=1,3,5,…,17
6
n 1 3 5 7 9 11 13 15 17
Trapezium rule (page 2.79) for the rest points (measuring point 19 – 20):
y19 + y20
A=h = 0, 2255
2
Total area:
Atotal = ∑ K n + A = 2,5032
u=(0.1:0.1:2);
i=[0.3 0.43 0.61 0.65 0.75 0.9 0.85 1 1.2 1.25 1.35 1.5 1.62 1.7 1.76 1.85 2
2.1 2.23 2.28];
n=length(u);
plot(u,i,'*');
hold on; % scilab: set(gca(),"auto_clear","off");
grid on; % scilab: set(gca(),"grid",[1 1]);
% ex 1:
XY=u*i';
X_Y=1/length(u)*sum(u)*sum(i);
X2=sum(u.^2); % oder X2=u*u'
X_2=1/length(u)*sum(u)*sum(u);
b=(XY-X_Y)/(X2-X_2);
a=1/n*(sum(i)-b*sum(u));
p=polyfit(u,i,1);
i_fit=p(1).*u+p(2);
plot(u,i_fit,'r');
% scilab solution:
% function y=FF(x,p),y=p(1)*x+p(2),endfunction
% function e=G(p,z),
% y=z(1),x=z(2);
% e=y-FF(x,p),
% endfunction
% [p,err]=datafit(G,[i;u],[1;0])
% ex 2:
i_a = zeros(1,n);
for k = 2:(n-1)
i_a(k)=(i(k-1)+i(k)+i(k+1))/3;
end
u_av=u(2:19);
i_av=i_a(2:19);
plot(u_av,i_av,'m'); % with magenta color
% ex 3:
n_iav=length(i_av);
i_grad = zeros(1,n_iav);
for k = 2:(n_iav-1)
i_grad(k)=(i_av(k+1)-i_av(k-1))/0.2;
end
i_grad_average=1/16*sum(i_grad(2:17));
% ex 4
K2=zeros(1,(n-2));
for k=1:2:(n-2)
%Kepler's barrel rule for measuring points 1- 19
K2(k)=(0.1/3)*(i(k)+4*i(k+1)+i(k+2));
%Trapezium rule for last two measuring points (19-20)