フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

If I have a vector S=[4 1 2 2 1 1 1 1 1 1] and I want to generate all possible matrices C with dim(10*10) with a condition that [C(i,:)+C(:,i)=S(1,i)] and the values in C are wanted to be integer (0,1,2,...)

1 回表示 (過去 30 日間)
Ahmed Ibrahim
Ahmed Ibrahim 2017 年 6 月 2 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
If I have a vector S=[4 1 2 2 1 1 1 1 1 1] and I want to generate all possible matrices C with dim(10*10) with a condition that [C(i,:)+C(:,i)=S(1,i)] and the values in C are wanted to be integer (0,1,2,...)
  4 件のコメント
Guillaume
Guillaume 2017 年 6 月 3 日
In matlab <R2016b, C(i, :) + C(:,i) is an error.
In matlab R2016b and later, C(i, :) + C(:, i) results in a 10x10 matrix.
So as John said, you need to explain CLEARLY what it is you want, using valid matlab syntax.
John D'Errico
John D'Errico 2017 年 6 月 3 日
編集済み: John D'Errico 2017 年 6 月 3 日
If you add two vectors (of the same length and shape) together, the result is a vector. So unless you also mean to sum the result, then as I said, your expression has no meaning.
If the goal is to solve this problem, where you also SUM those vectors (or something like that) then computing ALL possible such 10x10 arrays will be highly computationally intensive. And since everybody always really wants to solve much bigger problems than the examples they show, you will need to get a seriously big and fast computer.
Think of it like this: you have 100 unknown elements in that array. In this case, some of those elements may be as large as 4. So some elements may be as small as zero, or as large as 4.
So you will need to find ALL possible sets of 10x10 elements that satisfy the requirements. Depending on S, that may involve search a space of size
5^100
ans =
7.8886e+69
possible arrays. That is a moderately large number.
seven duovigintillion, eight hundred eighty eight unvigintillion, six hundred vigintillion
While it is true that many of the possible arrays can be dismissed immediately, a computer can not know that in advance. And of course, if your real problem is bigger than the example you show, you may well need a computer the size of the universe to solve it.

回答 (0 件)

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by