Performing calculations on a vector
조회 수: 15 (최근 30일)
이전 댓글 표시
I have a vector of (50,1) I need to apply a formula and perform calculations on each element in the vector how do I achieve this?
댓글 수: 2
James Tursa
2020년 5월 4일
Depends on the formula and whether the functions involved are vectorized or not. You may have to write a loop. What is your formula?
채택된 답변
James Tursa
2020년 5월 4일
The log10( ) function is vectorized, so just this
result = 20 * log10(4*pi*d./lambda);
추가 답변 (1개)
David Hill
2020년 5월 4일
Using elementwise functions and operators.
v.^2;
v.*m;%v and m same size
v./m;%v and m same size
v.^m;%va and m same size
...
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!