필터 지우기
필터 지우기

How to generate all the possible values for a vector?

조회 수: 1 (최근 30일)
Parikshit Pareek
Parikshit Pareek 2017년 6월 29일
댓글: Walter Roberson 2017년 6월 29일
I want to generate all the values of [r1;r2] such that 300<=r1,r2<=300. How can I do this?

채택된 답변

Walter Roberson
Walter Roberson 2017년 6월 29일
You cannot generate that. There are 4574883165222469632 representable double precision values for 300 <= r1, and 18437736874454810624 representable double precision values for r2 <= 300. Forming each pair of possibilities would give you 84350492031744868214373536880150970368 combinations, each 16 bytes long. That is just short of 2^130 bytes of storage required. There is not that much memory in the universe.
  댓글 수: 2
Parikshit Pareek
Parikshit Pareek 2017년 6월 29일
Thanks a lot.
Walter Roberson
Walter Roberson 2017년 6월 29일
The exact counts would be different if you restricted to integers, but the answer would be much that same, that you could not do it: your limitation 300<=r1 says that r1 is any representable value that is at least 300, and your limitation r2<=300 says that r2 is any representable value that is at most 300, including negatives.
Perhaps there are other constraints such as the total of the two is to remain fixed?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by