Performing calculations on a vector

29 views (last 30 days)
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 Comments
ReturnToCastle
ReturnToCastle on 4 May 2020
It is 20log10(4πd/λ), where d represents the elements in the vector

Sign in to comment.

Accepted Answer

James Tursa
James Tursa on 4 May 2020
The log10( ) function is vectorized, so just this
result = 20 * log10(4*pi*d./lambda);

More Answers (1)

David Hill
David Hill on 4 May 2020
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
...

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!