Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.09 KB | None | 0 0
  1. %% Flight Test 2 Ground Track Position
  2. % Aero 409 FLight Test
  3. % Josh Huang
  4. clear variables
  5. close all
  6. clc
  7. % plotOrientation
  8. load('test2.TXT')  
  9. accelReadings= test2(:,1:3);
  10. gyroReadings= (test2(:,4:6))*((2*pi)/360); %deg/s to rad/s
  11. magReadings= test2(:,7:9);
  12. t= (test2(:,11)-test2(1,11))/1000; % convert ms -> s, reset first digit to 0
  13.  
  14.  
  15. time =((test2(:,11)-test2(1,11))/1000);
  16. acc = accelReadings;
  17.  
  18. %%Design High Pass Filter
  19. fs = (max(time)-min(time))/length(time); % Sampling Rate
  20. fc = .1/60;  % Cut off Frequency
  21. order = 6; % 6th Order Filter
  22. %%Filter  Acceleration Signals
  23. [b1, a1] = butter(order,fc,'high');
  24. accf=filtfilt(b1,a1,acc);
  25.  
  26.  
  27. %%First Integration (Acceleration - Veloicty)
  28. velocity=cumtrapz(time,accf);
  29.  
  30. %%Filter  Veloicty Signals
  31. [b2, a2] = butter(order,fc,'high');
  32. velf = filtfilt(b2,a2,velocity);
  33. %%Second Integration   (Velocity - Displacement)
  34. Displacement=cumtrapz(time, velf);
  35. figure(4)
  36.  
  37. plot3(Displacement(:,1),Displacement(:,2),Displacement(:,3))
  38. xlabel('x')
  39. ylabel('y')
  40. zlabel('z')
  41.  
  42. figure(5)
  43. plot(Displacement(:,1),Displacement(:,2))
  44. %% ~7500 ft
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement