Performing calculations on a vector
Mostrar comentarios más antiguos
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 comentarios
James Tursa
el 4 de Mayo de 2020
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
el 4 de Mayo de 2020
Respuesta aceptada
Más respuestas (1)
David Hill
el 4 de Mayo de 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
...
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!