How to turn column y and row x vector into a matrix
조회 수: 2 (최근 30일)
이전 댓글 표시
Given: x = randn(1,20); y = randn(1,30);
I want to create a matrix B using x as row and y is column. I don't think B = y'.*x is correct since I want all the values are independently from x and y . Thanks!
댓글 수: 0
답변 (1개)
Steven Lord
2021년 12월 14일
How exactly should element B(r, c) be computed from the elements of x and y?
Rather than using random data, let x = 1:5 and y = 6:11. Show us the B matrix that those two vectors should generate and exactly the rule you follow in generating say B(2, 4).
If the elements in B aren't supposed to be related to the elements in x and y, and you just want to use x and y to indicate the size of the random B matrix to be created:
x = 1:5;
y = 6:11;
B = rand(numel(x), numel(y))
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!