Performing calculations on a vector
이전 댓글 표시
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?
ReturnToCastle
2020년 5월 4일
채택된 답변
추가 답변 (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
...
카테고리
도움말 센터 및 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!