matlab - Plotting Vector field of a point charge -


i have been trying model electric field of point charge using quiver command.

x=-5:0.5:5; y=-5:0.5:5; [xx,yy]=meshgrid(x,y); r=(xx.^2+yy.^2).^0.5; quiver(x,y,xx./r^3, yy./r^3,1); 

the resultant electric field follows, enter image description here

as can see length of vector increases move away charge (center). learned length of vector plotted quiver depends on magnitude of vector @ point. since electric field reduces move away, 1 expect length of vector should reduce away charge. tried understand or remedy not find anything.

can explain why happening or how can fixed.

thanks time. appreciated.

quite simple fix actually. forgot 2 dots.

x=-5:0.5:5; y=-5:0.5:5; [xx,yy]=meshgrid(x,y); r=(xx.^2+yy.^2).^0.5; quiver(x,y,xx./r.^3, yy./r.^3,1);  %% <---  note additional . in front of ^ 

enter image description here


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -