Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
error in creating a vector the spans the length of another vector
조회 수: 1 (최근 30일)
이전 댓글 표시
i am trying to make vector that ranges from 0 to 7/a for each value of a and contains 20 evenly spaced values.
a is a 1x5 vector
ive tried using linspace (Var=linspace(0,7/a,20))and the colon operator (Var=1:20:7/a) but using each, i get the following error message:
Error using /
Matrix dimensions must agree.
should i use a for loop?
댓글 수: 0
답변 (1개)
Ameer Hamza
2020년 9월 24일
Each row of M corresponds to one value in a
a = [1 2 3 4 5];
M = arrayfun(@(x) linspace(0, 7/x, 20), a, 'uni', 0);
M = vertcat(M{:});
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!