how to program given formula
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Avenger2020
am 7 Nov. 2020
Bearbeitet: Avenger2020
am 7 Nov. 2020
Neeed help on how to write this formula in matlab.
if n=100
i=(1,.....,n)
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (1)
Bryant Pong
am 7 Nov. 2020
Assuming that you have arrays of values for x and y:
n = 100;
% Preallocate memory to save some time (n - 1 values)
l = zeros(1, n - 1);
for i = 2:100
deltaX = x(i) - x(i - 1);
deltaY = y(i) - y(i - 1);
l(i - 1) = sqrt(deltaX^2 + deltaY^2);
end
0 Kommentare
Siehe auch
Kategorien
Mehr zu Matrix Indexing 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!