fix the soulation pleaase
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Walter Roberson
am 12 Sep. 2019
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.
Antworten (1)
Devineni Aslesha
am 12 Sep. 2019
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 Kommentare
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!