Resolution of a plotted function
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello Everyone,
I need to put this function (f) in a matrix to print it as a figure, but how can I put it in the same matrix (4001, 3001) with two resolutions (1um, 2um) and the same wavelength 100um?
May someone please help me in solving this query.
Thanks
f = @(x) 3*sin(x*2*pi/wavelength) + 1003;
% The function for the sine wave with the
% amplitude 3 µm and wave length of about 100 µm.
%Mean level is 1003 µm.
0 comentarios
Respuestas (1)
Rishi
el 30 de Dic. de 2023
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!
0 comentarios
Ver también
Categorías
Más información sobre Volume Visualization en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!