Optimization

*Modified Post*
I have a 3D matrix of this form:
gauss = values(3,3,3)
i.e
gauss(:,:,1) =
0.0155 0.0622 0.0155
0.0622 0.2494 0.0622
0.0155 0.0622 0.0155
gauss(:,:,2) =
0.0622 0.2494 0.0622
0.2494 1.0000 0.2494
0.0622 0.2494 0.0622
gauss(:,:,3) =
0.0155 0.0622 0.0155
0.0622 0.2494 0.0622
0.0155 0.0622 0.0155
What I want to do is create another 3D matrix of larger dimension, i.e of size (10,3,3)
I.e NewMatrix = zeros(10,3,3);
What I want:
NewMatrix(1:3,:,:) = NewMatrix(1:3,:,:) + gauss;
NewMatrix(2:4,:,:) = NewMatrix(2:4,:,:) + gauss;
NewMatrix(4:6,:,:) = NewMatrix(4:6,:,:) + gauss;
:
:
NewMatrix(8:10,:,:) = NewMatrix(8:10,:,:) + gauss;
So essentially I want to use the 'gauss' matrix fill the values of 'NewMatrix'. However, the placement of the matrix 'gauss' in 'NewMatrix' is to be optimized so that the values of 'NewMatrix' are as uniform as possible. Let me know if more clarification is needed. Any suggestion will be appreciated.

11 件のコメント

Andrew Newell
Andrew Newell 2011 年 5 月 30 日
Your question is very puzzling. Why do you want to generate a cylinder using spheres? How many spheres? Can they overlap? What orientation would the cylinder have?
Andrew Newell
Andrew Newell 2011 年 5 月 30 日
Is there any restriction on the number of such placements? Zero would be the most uniform solution.
Charles
Charles 2011 年 5 月 30 日
Yea, there would be restrictions to the number of placements, however, at the same position numerous additions could be made. I.e
NewMatrix(2:4,:,:) = NewMatrix(2:4,:,:) + gauss;
NewMatrix(2:4,:,:) = NewMatrix(2:4,:,:) + gauss;
:
NewMatrix(2:4,:,:) = NewMatrix(2:4,:,:) + gauss;
The idea is that given different fixed positions, to create the larger matix to be as uniform as possible in values.
Andrew Newell
Andrew Newell 2011 年 5 月 30 日
We're converging on a clear statement of the problem. You need to set some bounds on the number of placements. Also, what is the criterion for uniformity? Two possibilities: (1) difference between min and max, or (2) variance.
Charles
Charles 2011 年 5 月 31 日
Hi, thanks again for your comment. Criterion for uniformity is the variance.
Ivan van der Kroon
Ivan van der Kroon 2011 年 5 月 31 日
Hey, to be clear: this number should be as low as possible, std(reshape(g,numel(g),1))?
Why is it in three dimensions? The problem could be reformulated as size(gauss)=[3,9] and size(NewMatrix)=[10,9], right? This makes operations like kron possible.
Charles
Charles 2011 年 5 月 31 日
Hi Ivan, it is in 3 dimension because the task I want to solve is in 3D. However, if u have a solution for 2D, maybe I can adapt it to 3D, so give any suggestion that u have. The way you reformulated the problem, i.e size(gauss)=[3,9] and size(NewMatrix)=[10,9] is acceptable. Give your suggestion on how to best to place 'gauss' within 'NewMatrix'. Or is "std(reshape(g,numel(g),1)" the solution? If so, then I am confused as to the variable 'g' (is it gauss?) and where NewMatrix comes in. Thanks for your time.
Ivan van der Kroon
Ivan van der Kroon 2011 年 5 月 31 日
About the std(..): You said the uniformity should be deduced from the variance. So you want the standard deviation (std in matlab) to be as low as possible, correct? (the reshape is just to bring it to 1-D, because std only works for one dimension).
Second, how many placements should I think of? More than 10, more than 100? Btw, nice puzzle!
Charles
Charles 2011 年 5 月 31 日
Hi, placements should be limited to 3 or 4. However, there is another trick to the question as to reaching the least standard deviation. At each position, the smaller matrix can be weighted. I.e,
NewMatrix(1:3,:,:) = NewMatrix(1:3,:,:) + (gauss * 2);
NewMatrix(2:4,:,:) = NewMatrix(2:4,:,:) + (gauss * 0.4);
NewMatrix(4:6,:,:) = NewMatrix(4:6,:,:) + (gauss * 3);
:
:
NewMatrix(8:10,:,:) = NewMatrix(8:10,:,:) + (gauss * 5);
The idea thus, is creating this bigger matrix with the least std using fixed number of positions (say 3) and weighting of the 'gauss' matrix. Thanks for your interest :-)
Charles
Charles 2011 年 6 月 1 日
ANYBODY THERE? Make your suggestion pls :-)
Ivan van der Kroon
Ivan van der Kroon 2011 年 6 月 5 日
Just put all weigths zero. I assume this is too trivial. I also noticed you opened a new topic, where you reformulated it for 1-D.

回答 (0 件)

この質問は閉じられています。

タグ

質問済み:

2011 年 5 月 30 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by