English 中文(简体)
我如何在MATLAB中推广体现职能价值2D矩阵?
原标题:How do I scale a 2D matrix representing the values of a function in MATLAB?

我在MATLAB(say M1)有2D矩阵,代表一些数学功能 f(x,y)的数值。 我想通过一个因素来扩大这一职能,因为这个因素很复杂。 这就是说,我希望有一个包含功能 f(x/s, y/s)价值的矩阵(say M2)。 我如何这样做? 我不理解我原矩阵的行数与新矩阵之间的关系。 这就是我迄今为止的努力:

originalMatrix = magic(10);
s = 2; %scaling factor

% Get the size of the original matrix
[rows, cols] = size(originalMatrix);

% Create a grid of coordinates corresponding to the original matrix
[x, y] = meshgrid(1:cols, 1:rows);

% Scale the coordinates
scaledX = x / s;
scaledY = y / s;

% Create a grid of coordinates for the scaled matrix
[scaledCols, scaledRows] = size(originalMatrix);
scaledCols=scaledCols*m;
scaledRows=scaledRows*m;
[scaledXGrid, scaledYGrid] = meshgrid(1:scaledCols, 1:scaledRows);

我认为,我正确地建立了新的电网,但我可以说明如何开展工作。

洞穴:我不需要干涉——我对新坐标之间的数值是0,完全是罚款。 我承认,如果我的规模缩小,那么信息就会丢失——我对此感到 fine,但我不理解如何去做。 如果我最后认为需要干预,我使用什么方法? MATLAB是否有一些推广方法?

问题回答

You just need to index in to the original matrix with some skipping or duplication then, e.g.

originalMat=magic(10);
s=2;
originalMat(1:s:end,1:s:end);




相关问题
How are mobile service provider databases so fast?

i was wondering on how these databases which have over millions of records and millions of lookups per second soo fast. how are they optimised? are there any special servers hosting these databases? ...

C# Resized images have black borders

I have a problem with image scaling in .NET. I use the standard Graphics type to resize images like in this example: public static Image Scale(Image sourceImage, int destWidth, int destHeight) { ...

Performance tuning CakePHP application

I just got this quite large CakePHP app (about 20k lines of code), which isn t very clean and there is no documentation at all. The app is running in production, but it has really major problems with ...

AS3 按比例提升外部形象

目前,我正在利用一种 lo机,以动态方式载录XML图像,并将其放入一个grid网。 我有安排,所有数据都在顺利地装上,但现在我需要做......。

Using EC2 Load Balancing with Existing Wordpress Blog

I currently have a virtual dedicated server through Media Temple that I use to run several high traffic Wordpress blogs. Both tend to receive sudden StumbleUpon traffic surges that (I m assuming) ...

High-traffic, Highly-secure web API, what language? [closed]

If you were planning on building a high-traffic, very secure site what language would you use? For example, if you were planning on say building an authorize.net-scale site, that had to handle tons ...

热门标签