Working with meshgrid in MATLAB

How do you replace meshgrid with the following?

N=.33;
P=.45;

for i =1:10
    for j=1:20
        x0=i+N;
        y0=j+P;
        f(i,j)=exp(x0+y0);
    end
end
+3
source share
1 answer

I think something like

[X, Y] = meshgrid(1:10, 1:20);
Z = exp( (X+N) + (Y+P) );
% surf(X, Y, Z);

read here

change

at the request of the user (if I understand well):

[X, Y] = meshgrid(1:10, 1:20);
X1 = X + N; Y1 = Y + P; 
Z = exp( X1 + Y1 );
% surf(X1, Y1, Z);
+5
source

Source: https://habr.com/ru/post/1752779/


All Articles