Facebook
From as, 4 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 211
  1. function rlc_f_bisection
  2.     C1 = 2e-6;
  3.     C2 = 7e-6;
  4.     a = C1;
  5.     b = C2;
  6.     for i=1:100
  7.         c =(a+b)/2;
  8.         if f(a) * f(c) < 0
  9.             b = c;
  10.         else
  11.             a = c;
  12.         end
  13.         if((abs(f(a)) < 1e-7) || (abs(f(b)) < 1e-7))
  14.             break;
  15.         end
  16.         a
  17.         b
  18.         i
  19.     end
  20. end
  21.  
  22. function y = f(x)
  23.     f0 = 500;
  24.     L = 20e-3;
  25.     y = f0 - 1./(2*pi.*sqrt(L*x));
  26. end