thercktfsh

Characteristic Time Constant

Nov 14th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.72 KB | None | 0 0
  1. data = load('Test 2, Trial 4')
  2.  
  3. tInterval = 3.2 * 10^-8;
  4.  
  5. %Bounds
  6. a = 70000;
  7. b = 77000;
  8.  
  9. %Index Values
  10. firstIndex = 0;
  11. secondIndex = 0;
  12.  
  13. %Variables used to store indexes
  14. tempVal = 0;
  15. currVal = 0;
  16.  
  17. for i = a:b %Finds the first value
  18.     tempVal = data.A(i)
  19.     if tempVal < currVal
  20.         currVal = tempVal;
  21.         firstIndex = i;
  22.         break
  23.     end
  24. end
  25.  
  26. newAmpVal = currVal * 1/exp(1); %Finds the value that is 1/e of the initla amplitude
  27.  
  28. for i = firstIndex:100000
  29.     tempVal = data.A(i)
  30.     if tempVal >= newAmpVal %Only triggers when at the correct index
  31.         secondIndex = i;
  32.         break
  33.     end
  34. end
  35.  
  36. cTimeConst = secondIndex * 3.199999909497819e-08 - firstIndex * 3.199999909497819e-08
Advertisement
Add Comment
Please, Sign In to add comment