Question
Create a MATLAB script that will perform the following 1.Load the data from file normtemp.txt using the load() function First, load all three columns of
Create a MATLAB script that will perform the following
1.Load the data from file normtemp.txt using the load() function
First, load all three columns of data into a matrix X
The data is arranged in columns as follows: temperature, sex, age
Then, create a matrix variable temp for just the first column of X, which is the temperature
2.Generate a histogram with 12 bins
Label the x-axis Temperature
Label the y-axis Frequency
The title should be Temperature for Adult Males and Females
3.Now explore MATLABs built-in functions to calculate the following quantities for the temperature data.
mean(vector)
median(vector)
mode(vector)
var(vector)
std(vector)
Write a function called mystat.m that takes a vector of data and prints out all these descriptive statistics functions applied to the vector of data, and the length of the data vector. Run your function on the temp vector.
4.Use the code below to take a sample of the total data set and compare it with the results from (3) above
M=1;
for N = 1:5:length(temp)
sample(M) = temp (N);
M = M + 1;
end
Create a histogram with 12 bins for this data
Here are the results for the temperature array
mean = 98.25
median = 98.30
mode = 98.00
var = 0.54
std = 0.73
min = 96.30
max = 100.80
count = 130
I know its a lot, but I'm very lost.. If possible please add comments so I can see whats going on. Thank you
Here is the file normtemp.txt
96.3 1 70 96.7 1 71 96.9 1 74 97.0 1 80 97.1 1 73 97.1 1 75 97.1 1 82 97.2 1 64 97.3 1 69 97.4 1 70 97.4 1 68 97.4 1 72 97.4 1 78 97.5 1 70 97.5 1 75 97.6 1 74 97.6 1 69 97.6 1 73 97.7 1 77 97.8 1 58 97.8 1 73 97.8 1 65 97.8 1 74 97.9 1 76 97.9 1 72 98.0 1 78 98.0 1 71 98.0 1 74 98.0 1 67 98.0 1 64 98.0 1 78 98.1 1 73 98.1 1 67 98.2 1 66 98.2 1 64 98.2 1 71 98.2 1 72 98.3 1 86 98.3 1 72 98.4 1 68 98.4 1 70 98.4 1 82 98.4 1 84 98.5 1 68 98.5 1 71 98.6 1 77 98.6 1 78 98.6 1 83 98.6 1 66 98.6 1 70 98.6 1 82 98.7 1 73 98.7 1 78 98.8 1 78 98.8 1 81 98.8 1 78 98.9 1 80 99.0 1 75 99.0 1 79 99.0 1 81 99.1 1 71 99.2 1 83 99.3 1 63 99.4 1 70 99.5 1 75 96.4 2 69 96.7 2 62 96.8 2 75 97.2 2 66 97.2 2 68 97.4 2 57 97.6 2 61 97.7 2 84 97.7 2 61 97.8 2 77 97.8 2 62 97.8 2 71 97.9 2 68 97.9 2 69 97.9 2 79 98.0 2 76 98.0 2 87 98.0 2 78 98.0 2 73 98.0 2 89 98.1 2 81 98.2 2 73 98.2 2 64 98.2 2 65 98.2 2 73 98.2 2 69 98.2 2 57 98.3 2 79 98.3 2 78 98.3 2 80 98.4 2 79 98.4 2 81 98.4 2 73 98.4 2 74 98.4 2 84 98.5 2 83 98.6 2 82 98.6 2 85 98.6 2 86 98.6 2 77 98.7 2 72 98.7 2 79 98.7 2 59 98.7 2 64 98.7 2 65 98.7 2 82 98.8 2 64 98.8 2 70 98.8 2 83 98.8 2 89 98.8 2 69 98.8 2 73 98.8 2 84 98.9 2 76 99.0 2 79 99.0 2 81 99.1 2 80 99.1 2 74 99.2 2 77 99.2 2 66 99.3 2 68 99.4 2 77 99.9 2 79 100.0 2 78 100.8 2 77
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started