Advertisement
hiddenGem

A Certain Capacitor

Jul 16th, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.53 KB | None | 0 0
  1. %% A Certain Capacitor
  2. % Determines the capacitive reactance at a certain frequency
  3.  
  4. % Inputs and Variables
  5. R1 = input('Known resistance\n');
  6. f1 = input('Known frequency\n');
  7. a = input('Do you know the frequency or resistance?\n');
  8. switch a
  9.     case 1
  10.     f2 = input('Other frequency\n');
  11.     R2 = R1*f1/f2;
  12.     fprintf('The unknown capacitive reactance is %.3f Ohm\n ', R2)
  13.     case 2
  14.     R2 = input('Other resitance\n');
  15.     f2 = R1*f1/R2;
  16.     fprintf('The frequency is %.3f Hz\n', f2)
  17. end
  18.  
  19.  
  20. % Ouputs and Equations
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement