Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.49 KB | None | 0 0
  1. clear, clc;
  2.  
  3. a = importdata("realDataEdit.csv");
  4.  
  5. x = a.data(:,3);
  6. y = a.data(:,6);
  7.  
  8. scatter(x,y);
  9.  
  10. coeffs = polyfit(x, y, 1);
  11.  
  12. fittedX = linspace(min(x), max(x), 200);
  13. fittedY = polyval(coeffs, fittedX);
  14.  
  15. hold on;
  16.  
  17. plot(fittedX, fittedY, 'r-', 'LineWidth', 3);
  18. xlabel('Altitude Above Sea Level (feet)');
  19. ylabel('TVOC Concentration (parts per billion)');
  20. title('TVOC Concentration vs Altitude');
  21. ylim([-1,35]);
  22.  
  23. legend({'Measurement Point','Line of Best Fit'},'Location','northeast')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement