fix the soulation pleaase
1 回表示 (過去 30 日間)
古いコメントを表示
Please any one can fix this for me please
>> [x,y]=meshgrid(-pi:0.1:pi,-pi:0.1:pi);
>> z=exp(-x.^2*y.^2).*sin(x*y);
>> mesh(x,y,z); axis image;
>> options= {,'interpreter','latex','fontSize',14}; % Use LATEX for labeling
>> xlabel('$x$-axis',options{:}); ylabel('$y$-axis',options{:});
>> title('ASCENT',options{:});
>> hold on
>> p=[-1.6,-1.6];
>> plot(p(1,1),p(1,2),'or','MarkerSize',10);
>> x=p(1,size(p,2));
>> y=p(2,size(p,2));
Index in position 1 exceeds array bounds (must not exceed 1).
>> y=p(1,size(p,2));
>> fx=-2*x*y^2*exp(-x^2*y^2)*sin(x*y);
>> fy= -2*x^2*y*exp(-x^2*y^2)*sin(x*y);
>> p=[p p(:,size(p,2))+0.2*[fx;fy]]; % the only line that really maters
Error using horzcat
Dimensions of arrays being concatenated are not consistent.
1 件のコメント
Walter Roberson
2019 年 9 月 12 日
I already explained this to you.
You need to decide whether your y coordinates are to be stored in the second column of the variable, or in the second row of the variable.
回答 (1 件)
Devineni Aslesha
2019 年 9 月 12 日
In the provided code, the size of p is 1x2. However, the size of p(:,size(p,2))+0.2*[fx;fy] is 2x1. While concatenating horizontally, all the arrays should have the same number of rows. So, it can be concatenated as shown below.
p = [p p(: , size(p,2))+0.2*[fx fy]];
Doc Link:
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!