Index in position 1 exceeds array bounds (must not exceed 1).

1 次查看(过去 30 天)
Hi Every one I am trying to run the follow grdeint but it give me Index in position 1 exceeds array bounds (must not exceed 1). please can you help me to find the problem and how i can fix it.
>> [x,y]=meshgrid(-2*pi:0.1:2*pi,-2*pi:0.1:2*pi);
>> z=acos(cos(sqrt(x^2 +x^2)))+acos(sin(x));
>> mesh(x,y); axis image;
>> options={,'interpreter','latex','fontSize',14};% Use LATEX for labeling
>> options={,'interpreter','latex','fontSize',14};% Use LATEX for labeling
>> title('Asecent',options{:});
>> hold on
>> p=[-1.5,-6];
>> plot(p(1,1),p(1,2),'or','MarkerSize',10);
>> for i=1:71
x=p(1,size(p,2));
y=p(2,size(p,2));
  6 个评论
the cyclist
the cyclist 2019-9-9
You do not know what code to put. That is OK.
But what are you trying to do? What are you trying to add to your figure? We can help with the code, but not if we don't know what you are trying to DO.
Walter Roberson
Walter Roberson 2019-9-9
Your for i=1:71 is not suggestive to us, since your x and y and z are 126 x 126.
Are you trying to loop through all (x,y) pairs?
xy = [x(:), y(:)];
for i = 1 : size(xy,1)
thisx = xy(i,1); thisy = xy(i,2);
end

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

标签

尚未输入任何标签。

产品


版本

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by