HW7 #1 - % maximum measured mpg values. [freq,centers] =...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 %Engineering 6, Spring 2004, Problem 7.1 %Ryan Uy, 2509 %Section B05, Tues. 3-4 % File mpg.dat contains on each line the measured gas mileage in miles per % gallon. Use disp commands to label and display the results of the following. load mpg.dat %loads values from file mpg.dat into a vector array named mpg % (a) The number of measured mpg values disp('(a)') disp('Number of measured mpg values:') % (b) The minimum and maximum mpg values. disp('(b)') disp('Maximum mpg value:') disp('Minimum mpg value:') % (c) The mean and median mpg values. disp('(c)') disp('Mean mpg value:') disp('Median mpg value:') % (d) The standard deviation and variance of the mpg values. disp('(d)') disp('Standard deviation of mpg:') disp('Variance of mpg:') % (e) A relative histogram plot having 16 bins between the minimum and
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % maximum measured mpg values. [freq,centers] = hist(mpg,16) rel_freq = freq/(length(mpg)) bar(centers,rel_freq) Sheet1 Page 2 disp(length(mpg)) disp(max(mpg)) disp(min(mpg)) disp(mean(mpg)) disp(median(mpg)) disp(std(mpg)) disp(std(mpg)^2) %use hist function to find histogram and centers %relative frequency is found by dividing histogram by total elements %plot bar graph using centers and relative frequency Sheet1 Page 3 %length function %max and min functions find %the max and min in a vector array %mean and median functions find %the mean and median in a vector %std function finds standard deviation %variance = standard deviation squared...
View Full Document

Page1 / 3

HW7 #1 - % maximum measured mpg values. [freq,centers] =...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online