No BSD License  

Highlights from
MATLAB for Engineers

from MATLAB for Engineers by Adrian Biran
Companion Software

exe11_13.m
EXE11_13        Solves Exercise 11.13, RMS value in varistor circuit.

%rm2    rms value of current in first varistor example

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
c = polyfit(log(U), log(I), 1);
a = exp(c(2)); n = c(1);
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;
Imax = max(i)
Ieff = sqrt(trapz(t, i.^2)/T)         % rms value of current

Contact us at files@mathworks.com