Error when plotting a 2-D vector field
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello Mathworks Community,
I am trying to plot the electric field vector on matlab , but I am encountering problems. I would like to write the x and why components of the vector field described in the picture below.
When I try to write x component of the vector field i encounter the error mentioned below.
Thank you for your help

>> Nx=100; %number of mesh points on x-axis
>> Ny=100; %number of mesh points on y-axis
>> xrng = linspace (-100,100,Nx);
>> yrng= linspace(0,200,Ny); %specifying the ranges for the x and y axes
>> [X_grd, Y_grd] = meshgrid(xrng,yrng); %2-D grid
>> Eps=8.854*10^-12;
>> E_x=2*(X_grd-2)/k((X_grd-2).^2 +(Y_grd-2).^2).^3/2;
Array indices must be positive integers or logical values.
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Octave dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!