MATLAB: Performing calculations on a vector

loopsMATLABvectorvectors

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?

Best Answer

  • The log10( ) function is vectorized, so just this
    result = 20 * log10(4*pi*d./lambda);