Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %% Line integral over a closed path ABCA
- % I haven't figured out a way so that the use only has to enter the vector field 'F' once so you'll just have to just copy and paste it when it asks for it again and again
- syms t x y z
- A = input('coordinates for A\n');
- B = input('coordinates for B\n');
- C = input('coordinates for C\n');
- v_AB = B-A;
- v_BC = C-B;
- v_CA = A-C;
- v_AB = t.*v_AB;
- v_BC = t.*v_BC;
- v_CA = t.*v_CA;
- % Creates parametrized lines for the three lines
- c1 =A+v_AB;
- c2 =B+v_BC;
- c3 =C+v_CA;
- % Calculates derivative of the three lines
- C1 = diff(c1,t);
- C2 = diff(c2,t);
- C3 = diff(c3,t);
- % F(c1)
- x = c1(1);
- y = c1(2);
- z = c1(3);
- fc1 = input('Vector field\n');
- % F(c2)
- x = c2(1);
- y = c2(2);
- z = c2(3);
- fc2 = input('Vector field\n');
- % F(c3)
- x = c3(1);
- y = c3(2);
- z = c3(3);
- fc3 = input('Vector field\n');
- % Calculates the individual integrals
- a = int(dot(fc1,C1),t,0,1);
- b = int(dot(fc2,C2),t,0,1);
- c = int(dot(fc3,C3),t,0,1);
- a+b+c
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement