Question

In: Mechanical Engineering

Get the avehighs.txt file from BB. The file contains monthly average temperatures from three different locations

 

Get the avehighs.txt file from BB. The file contains monthly average temperatures from three different locations. The location ID is in the first column and monhtly average temperatures are in the next 12 columns. Write a script that will:

data from file

avehighs

432 33 37 42 45 53 72 82 79 66 55 46 41
777 29 33 41 46 52 66 77 88 68 55 48 39
567 55 62 68 72 75 79 83 89 85 80 77 65

1. load the data

2. call a function that will (a) plot the data on a column of subplots (b) place an x label, months, on the last plot (c) place a ylabel,Monthly Avg Temp (F), on the second plot, (d) for a bonus put a legend on each plot that indicates the location id, and (e) return the yearly average temperatures and the location ID as three two element vectors

3. Display the average yearly temp for each location.

Solutions

Expert Solution

% MATLAB script is as follows

% Function

function [ avgt ayt ] = temperature( A )

%UNTITLED Summary of this function goes here

% Detailed explanation goes here

month=1:12;

subplot(3,1,1)

plot(month,A(1,(2:end)))

legend('432')

subplot(3,1,2)

plot(month,A(2,(2:end)))

ylabel('Monthly Avg Temp (F)')

legend('777')

subplot(3,1,3)

plot(month,A(2,(2:end)))

xlabel('months')

legend('567')

avgt=[432 mean(A(1,(2:end))); 777 mean(A(2,(2:end))); 567 mean(A(3,(2:end)));]; %yearly average temperatures and the location ID as three two element vectors

ayt= avgt(:,2); %average yearly temp for each location

end

% MATLAB script

clear all

clc

A= importdata('avehighs.txt');

[ avgt ayt ] = temperature( A )

% Results


Related Solutions

The data file wages contains monthly values of the average hourly wages (in dol-lars) for workers...
The data file wages contains monthly values of the average hourly wages (in dol-lars) for workers in the U.S. apparel and textile products industry for July 1981 through June 1987. (a) Display and interpret the time series plot for these data. (b) Use least squares to fit a linear time trend to this time series. Interpret the regression output. Save the standardized residuals from the fit for further analysis. (c) Construct and interpret the time series plot of the standardized...
The data below are the average monthly temperatures, in °F, and the monthly natural gas consumption,...
The data below are the average monthly temperatures, in °F, and the monthly natural gas consumption, in ccf, for a household in northwestern Pennsylvania. a.)Test the significance of the correlation coefficient using α = 0.05 and the claim ρ < 0. Identify the claim, state the null and alternative hypotheses, find the critical value, find the standardized test statistic, make a decision on the null hypothesis (you may use a P-Value instead of the standardized test statistic), write an interpretation...
Zagat’s publishes restaurant ratings for various locations in the United States. The file Restaurants contains the...
Zagat’s publishes restaurant ratings for various locations in the United States. The file Restaurants contains the Zagat rating for food, décor, service, and the cost per person for a sample of 100 restaurants located in New York City and in a suburb of New York City. Develop a regression model to predict the cost per person, based on a variable that represents the sum of the ratings for food, décor, and service. a. Construct a scatter plot. b. Assuming a...
1. The Zumber National Rent Report lists the average monthly apartment rent in various locations in...
1. The Zumber National Rent Report lists the average monthly apartment rent in various locations in the United States. According to their report, the average cost of renting a one-bedroom apartment in Houston is $1,090. Suppose that the standard deviation of the cost of renting a one-bedroom apartment in Houston is $96 and that such apartment rents in Houston are normally distributed. If a one-bedroom apartment in Houston is randomly selected, what is the probability that the price is: (20...
1. a) Suppose average monthly sales for retail locations across the United States are approximately normally...
1. a) Suppose average monthly sales for retail locations across the United States are approximately normally distributed with variance σ^2= 5200. We took a sample of size 50 and found ̄x= 12018,  Using this, conduct a hypothesis test with α= 0.05 to test the null hypothesis that the mean is 12000 vs. the alternative hypothesis that it is not. For full credit, state the null and alternative hypothesis, the test statistic, the rejection region, and your conclusion. b)Using the setup from...
1. a) Suppose average monthly sales for retail locations across the United States are approximately normally...
1. a) Suppose average monthly sales for retail locations across the United States are approximately normally distributed with variance σ^2= 5200. We took a sample of size 50 and found ̄x= 12018,  Using this, conduct a hypothesis test with α= 0.05 to test the null hypothesis that the mean is 12000 vs. the alternative hypothesis that it is not. For full credit, state the null and alternative hypothesis, the test statistic, the rejection region, and your conclusion. b)Using the setup from...
After reading page 704 to 707 from the file “Chapter 17- Rittenberg” (available in BB): a/...
After reading page 704 to 707 from the file “Chapter 17- Rittenberg” (available in BB): a/ Explain in detail the differences between monetarist view and Keynesian view about the functioning of the economy and the role of economic policy ( you discuss both fiscal and monetary policy). b/ According to Milton Friedman, how did the US economy end up by exhibiting high inflation rate and high unemployment rate early 70s ?
Get the file “HW4Part4b.java” from the repository. Modify the program class to match the new file...
Get the file “HW4Part4b.java” from the repository. Modify the program class to match the new file name. Complete it by writing a recursive static int function named recur that is defined as follows: if i ≤ 0 or j ≤ 0, recur(i, j) = 0. if i = j, recur(i, j) = i. if i > j, recur(i, j) = j. In all other cases, recur(i, j) = 2 · recur(i − 1, j) + recur(j − 1, i) Add...
An organism is heterozygous at three genetic loci (Aa, Bb and Cc) located on different chromosomes....
An organism is heterozygous at three genetic loci (Aa, Bb and Cc) located on different chromosomes. Explain how these alleles are transmitted by the process of A) mitosis to daughter cells, and B) meiosis to gametes Show the final genetic composition of the daughter cells or gametes with respect to these loci? C. How many different allelic combinations are possible with 8 heterozygous loci on 8 different chromosomes?
List the order of all structures and locations through which light passes to get from the...
List the order of all structures and locations through which light passes to get from the outside world to where rods and cones receive light waves to depolarize.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT