Error when plotting a 2-D vector field
2 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Octave についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!