Advertisement
makispaiktis

Tutorial - Mean and variance

Aug 11th, 2021 (edited)
1,286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.37 KB | None | 0 0
  1. clc
  2. clear all
  3.  
  4. R = csvread('random_integers.csv');
  5. x = 1:length(R);
  6. meanR = mean(R)
  7. varR = var(R)
  8. stdR = sqrt(varR)
  9.  
  10. plot(x, R, 'blue');
  11. title('Statistical Analysis');
  12. xlabel('x');
  13. ylabel('y(x)');
  14. hold on
  15. meanList = zeros(length(R), 1);
  16. for i = 1:length(meanList)
  17.     meanList(i) = meanR;
  18. end
  19. plot(x, meanList, 'red');
  20. legend('Random integers', 'Mean value');
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement