CodeCodeCode

ENGR132: HW07 - hw07_heatxchanger_name

May 6th, 2012
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.66 KB | None | 0 0
  1. %  Program Description: Imports temperature values after a heat exchange
  2. %  and presents the mean, standard deviation, minimum and maximum of the
  3. %  data as well as presenting a histogram.
  4.  
  5. % --- INPUTS ---
  6. %Data is read, skipping the header.
  7. thermo_vals = dlmread('thermocouple.dat', '\n', 1, 0);
  8.  
  9.  
  10. % --- CALCULATIONS ---
  11. %Data is sorted
  12. sort(thermo_vals)
  13. %Prints the minimum.
  14. fprintf('Minimum of values: %0.4f°C', min(thermo_vals));
  15. %Prints the maximum.
  16. fprintf('\nMaximum of values: %0.4f°C', max(thermo_vals));
  17. %Prints the mean.
  18. fprintf('\nMean of values: %0.4f°C', mean(thermo_vals));
  19. %Prints the standard deviation.
  20. fprintf('\nStandard Deviation of values: %0.4f°C\n', std(thermo_vals));
  21.  
  22. %Prints mean in terms of °F.
  23. fprintf('\nMean in terms of °F: %0.4f°F\n', convtemp(mean(thermo_vals), 'C', 'F'));
  24.  
  25. % --- OUTPUTS ----
  26. %Histogram created based on given values.
  27. hist(thermo_vals);
  28. title('Frequency of Temperature Values After Heat Exchange');
  29. xlabel('Temperature (°C)');
  30. ylabel('Frequency');
  31. grid;
  32.  
  33. %There was an error in data entry while attempting to import the entire
  34. %file.  "thermocouple.dat" seems to have a header on the first line, which
  35. %is just a string.  As such, the first line is skipped to read the
  36. %temperature values.
  37.  
  38. % Minimum of values: 82.3000°C
  39. % Maximum of values: 90.4000°C
  40. % Mean of values: 87.0120°C
  41. % Standard Deviation of values: 2.5112°C
  42.  
  43. % Mean in terms of °F: 188.6216°F
  44.  
  45. %The system seems to be working exactly as it is predicted to work.  The
  46. %mean of the temperatures falls very close to the value that the pdf
  47. %specifies and the minimum and maximum values do not exceed the given +-5
  48. %degrees.
Advertisement
Add Comment
Please, Sign In to add comment