Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %% Capacitance Sum
- % This script will calculate the sum of capacitors in series and in parallel
- % Notes and clarification are at the bottom of the code.
- capacitances = input('Input capacitors values with brackets\n');
- a = input('Capacitance in series or in parallel?\n');
- switch a
- case 1
- cap1 = 1./capacitances;
- cap2 = sum(cap1);
- Cap = 1/cap2;
- case 2
- Cap = sum(capacitances);
- end
- fprintf('The sum of the capacitors is %i F \n',Cap)
- %{
- When a user inputs the capacitances, [] must be placed around the numbers for the
- code to work properly
- %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement