-
Notifications
You must be signed in to change notification settings - Fork 0
/
BSmag_add_filament.m
36 lines (34 loc) · 1.45 KB
/
BSmag_add_filament.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function [BSmag] = BSmag_add_filament(BSmag,Gamma,I,dGamma)
%---------------------------------------------------
% NAME: BSmag_add_filament.m
% WHAT: Adds a filament to the BSmag analysis.
% REQUIRED: BSmag Toolbox 20150407
% AUTHOR: 20150407, L. Queval ([email protected])
% COPYRIGHT: 2015, Loic Quéval, BSD License (http://opensource.org/licenses/BSD-3-Clause).
%
% USE:
% [BSmag] = BSmag_add_filament(BSmag,Gamma,I,dGamma)
%
% INPUTS:
% BSmag = BSmag data structure
% Gamma = Filament points coordinates (x,y,z), one point per line [m,m,m]
% I = Filament current (flows from first point towards last point) [A]
% dGamma = Filament max discretization step [m]
%
% OUTPUTS:
% BSmag = Updated BSmag data structure
% BSmag.Nfilament = Number of filaments
% BSmag.filament(*).* = Filament structure
% BSmag.filament(*).Gamma = Filament points coordinates (x,y,z), one point per line [m,m,m]
% BSmag.filament(*).I = Filament current (flows from first point towards last point) [A]
% BSmag.filament(*).dGamma = Filament max discretization step [m]
%----------------------------------------------------
n = BSmag.Nfilament+1;
BSmag.filament(n).Gamma = Gamma;
BSmag.filament(n).I = I;
BSmag.filament(n).dGamma = dGamma;
BSmag.Nfilament = n;
%Plot P (where there is a current source)
figure(1)
plot3(Gamma(:,1),Gamma(:,2),Gamma(:,3),'.-r')
axis tight