Hello Simira,
I undersrand that you want to know how to use same function 'f' with two different resolutions in a matrix of same size.
Here is the code to do the same, assuming that the matrix dimensions refer to the number of data points:
wavelength = 100;
matrix_size_x = 4001; % number of points in the x-dimension
matrix_size_y = 3001; % number of points in the y-dimension
f = @(x) 3*sin(x*2*pi/wavelength) + 1003;
[x_1um, y_1um] = meshgrid(0:1:(matrix_size_x-1), 0:1:(matrix_size_y-1));
matrix_1um = f(x_1um);
[x_2um, y_2um] = meshgrid(0:2:(2*matrix_size_x-2), 0:2:(2*matrix_size_y-2));
matrix_2um = f(x_2um);
figure;
imagesc(matrix_1um);
colorbar;
title('Function f at 1um resolution');
figure;
imagesc(matrix_2um);
colorbar;
title('Function f at 2um resolution');
To learn about 'meshgrid' function, you can refer to the following documentation:
Hope this helps!