Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %% Line Segment with a Current
- % Determines the magnetic field of a line segment that bends at a point
- % Constants
- muNaught = (4*pi)*10^-7 ; %[T*m/A] Vacuum Permeability
- % Inputs and Variables
- I = input('What is the current?\n');
- d = input('What is the distance from the point to the horizon line\n');
- opp = input('Vector component that is parallel to the horizon line\n');
- % Outputs and Equations
- hyp = sqrt(opp^2+d^2);
- B = (1+opp/hyp)*muNaught*I/(4*pi*d);
- fprintf('The magnitude of the field is %.3e T', B)
- %{
- If the point is not under the line segment then when the program asks for
- the 'vector component that is parallel to the horizon', the user should
- enter the negative value
- Assumes the line segment is in two parts. One part is long like the horzion
- and the other part is bent off like ran into something.
- If you were to draw a vector coming out of the point that is directed at
- the 'bent corner' of the line segment, the component that is parallel
- to the horizon line will be the variable 'opp'. To check if your vector
- is drawn correctly, the other component should be parallel to the
- distance vector 'd'.
- %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement