フィルターのクリア

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 Center および File ExchangeVolume Visualization についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by