Performing calculations on a vector
17 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
ReturnToCastle
am 4 Mai 2020
Kommentiert: ReturnToCastle
am 4 Mai 2020
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 Kommentare
James Tursa
am 4 Mai 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?
Akzeptierte Antwort
James Tursa
am 4 Mai 2020
The log10( ) function is vectorized, so just this
result = 20 * log10(4*pi*d./lambda);
Weitere Antworten (1)
David Hill
am 4 Mai 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
...
0 Kommentare
Siehe auch
Kategorien
Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!