Creating an vector field

Pedro Ledoux p_ledoux at yahoo.com.br
Fri Aug 13 00:40:34 CEST 2010


Hello

An supposed charge in in origin. Thus it create a vector field around it. This can be obtained from Coulomb's law. When I tried to create the vector field caused by this charge I used the commands:

x=-1:0.1:1;  
y=x;
[X Y]=meshgrid(x,y)
r=sqrt(X.^2+Y.^2)+%eps //I sumed with eps to avoid a error by division for 0
ax=X./r;
ay=Y./r
champ(x,y,ax,ay)

The field that I got with those command lines wasn't what I wanted. but using the code bellow Scilab took the correct field.

x=-1:0.1:1;  

y=x;

[Y X]=meshgrid(x,y)

r=sqrt(X.^2+Y.^2)+%eps //I sumed with eps to avoid a error by division for 0

ax=X./r;

ay=Y./r

champ(x,y,ax,ay)

Acording to manual the first code should give me the correct field. In Octave a similar code gave me the correct field. Is seems thar or champ or meshgrid function inverted the things in Scilab.



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20100812/3afc36ba/attachment.htm>


More information about the users mailing list