Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
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 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Guillaume
am 3 Jun. 2017
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
am 3 Jun. 2017
Bearbeitet: John D'Errico
am 3 Jun. 2017
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.
Antworten (0)
Diese Frage ist geschlossen.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!