Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. clearvars
  2. load('training_pairs')
  3.  
  4. for i=1:length(position)
  5. t1 = angle_array(i,1);
  6. t2 = angle_array(i,2);
  7. t3 = angle_array(i,3);
  8.  
  9. phi(:,i) = [t1 t2 t3 1]';
  10. phi2(:,i) = [t1^2 t2^2 t3^2 t1*t2 t2*t3 1]';
  11. end
  12.  
  13. Phi = phi'
  14. Phi2 = phi2'
  15. alpha = Phi\position;
  16. alpha2 = Phi2\position;
  17. Yls = Phi*alpha;
  18. Yls2 = Phi2*alpha2;
  19. immse(Yls, position)
  20. immse(Yls2, position)
  21.  
  22. % plot x to compare
  23. plot(1:10, position(:,1),1:10, Yls(:,1))
  24. % plot x to compare
  25. plot(1:10, position(:,2),1:10, Yls(:,2))
  26. % plot y to compare
  27. plot(1:10, position(:,3),1:10, Yls(:,3))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement