Finding distance from a projectile.
이전 댓글 표시
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);
답변 (1개)
Adam Danz
2021년 3월 29일
0 개 추천
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.
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!