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일)
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