필터 지우기
필터 지우기

Resolution of a plotted function

조회 수: 2 (최근 30일)
simira atraqi
simira atraqi 2012년 4월 17일
답변: Rishi 2023년 12월 30일
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.

답변 (1개)

Rishi
Rishi 2023년 12월 30일
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!

카테고리

Help CenterFile Exchange에서 Volume Visualization에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by