Finding distance from a projectile.
Ältere Kommentare anzeigen
What is each line is doing on this code?
D=[1 xi(end);1 newx];
b=[yi(end);newy];
a=D\b
Distance = (-a(1)/a(2))
newx = Distance;
newy = 0;
b=[ui(end);newu];
a=D\b;
u2 = (a(1)+a(2)*Distance);
newu = u2;
b=[vi(end);newv];
a=D\b;
v2 = (a(1)+a(2)*Distance);
newv = v2;
newv = -(newv*COR);
Antworten (1)
Adam Danz
am 29 Mär. 2021
0 Stimmen
Much of this is basic Matlab syntax that should be understood in order to do almost anything in Matlab. Take some time to go through the Matlab Onramp to get caught up.
xi(end) is indexing the variable xi, retrieving is end or last value.
D=[1 xi(end);1 newx] is creating a 2x2 matrix.
Kategorien
Mehr zu Matrix Indexing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!