Don't know how to Loop
Afficher commentaires plus anciens
Hi.
I don't know how to solve this. I have this code
for i= 1:19
[x(i),y(i),z(i)] = multilaterasi(Reader(1, 1), Reader(1, 2), Reader(1, 3), Distance(1,i), Reader(2, 1), Reader(2, 2), Reader(2, 3), Distance(2,i), Reader(3, 1), Reader(3, 2), Reader(3, 3), Distance(3,i), Reader(4, 1), Reader(4, 2), Reader(4, 3), Distance(4,i));
end
I want to calculate the MSE from that code below with this formula.
MSE = sqrt((x(i)-xa)^2+(y(i)-1)^2+(z(i)-1.5)^2)
x(i), y(i), and z(i) should looping with for 1:19. But xa should looping with step 2 (the result should be 2,4,6,8,10,12 until 38). For example:
MSE = sqrt((x(1)-2)^2+(y(1)-1)^2+(z(1)-1.5)^2)
MSE = sqrt((x(2)-4)^2+(y(2)-1)^2+(z(2)-1.5)^2)
MSE = sqrt((x(3)-6)^2+(y(3)-1)^2+(z(3)-1.5)^2)
and the same for the rest until x(19), y(19), z(19) and xa=38
Please help. Thank you
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur MATLAB dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!