Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %% Two Parallel Wires
- % Determines the magnetic field from two parallel wires from two different
- % spots.
- % Constants
- muNaught = (4*pi)*10^-7 ; %[T*m/A] Vacuum Permeability
- B = muNaught/(2*pi);
- % Inputs and Variables
- I = input('Input the currents in brackets\n');
- dQ = input('Input the distance from the currents to the point between them in brackets\n');
- dP = input('Input the distance from the currents to the point outside the wires in brackets\n ');
- % Outputs and Equations
- bq1 = B*I(1)/dQ(1);
- bq2 = B*I(2)/dQ(2);
- bp1 = B*I(1)/dP(1);
- bp2 = B*I(2)/dP(2);
- Q = bq1-bq2;
- P = bp1+bp2;
- fprintf('The magnetic field at the point between and outside the two wires are %.4e T and %.4e T', Q,P)
- %{
- 'B' really isn't a constant but just a multiplying factor used many times
- and I was just too lazy to type it out.
- When the user is asked to input the distance from the parallel wires it
- should be as follows: [distance from wire 1 to the middle point, distance
- from wire 2 to the middle point]. The order of the distances should
- match the order of the currents in the input from the line above.
- Under the assumption where Q is between the wires and P is somewhere to the
- outside of one of thee wires. The code might be fallible whether or not
- the sign of the values are right based on the direction of the long
- wires. This particular code runs where the two parallel wire run in the
- same direction
- Very similar to the Long Wire script but this deals with parallel wires
- going alongside the page where the other script deals with the wire going
- in or out of the page.
- To calculate the magnetic field at 'Q' the magnetic fields from the two
- wires, they must be subtracted because the forces are in opposite
- directions. On the other hand to calculate 'P' the magnetic fields must
- be added because they are in the same direction.
- %}
Add Comment
Please, Sign In to add comment