%EXER9_11 Solves Exercise 9.11, A varistor circuit.
U = [ 12 18 25 30 35 40 45 ]; % measured voltage, V
I = [ 0.5 1 2.3 3.5 5.7 8.8 12.9 ]; % measured current, mA
plot(U, I), grid
xlabel('V'), ylabel('mA')
pause
disp('To continue press any key')
c = polyfit(log(U), log(I), 1);
a = exp(c(2)), n = c(1);
y = a*U.^n;
plot(U, I, U, y, '*'), pause
pause
disp('To continue press any key')
disp('Try now effect on alternating current, 48 V.')
f = 50; % frequency, Hz
T = 1/f; % period, s
t = 0: T/50: 2*T; % time scale, s
u = 48*sin(2*pi*50*t); i = sign(u)*a.*abs(u).^n;
plot(t, u, t, i), xlabel('s')
title('umax = 48 V')
text(t(5), u(5), 'u, V')
text(t(15), i(15), 'i, mA')