In: Mechanical Engineering
Day | High temperature, C | Low temperature, C |
1 | 30 | 25 |
2 | 32 | 26 |
3 | 34 | 23 |
4 | 29 | 20 |
5 | 31 | 19 |
6 | 30 | 21 |
7 | 25 | 18 |
The high and low temperatures of each day in Wichita KS are given in Table. (1 pt) (a) Plot the high temperature for 7 days as a function of day, i.e., high temperature on y-axis, and day # on x-axis. Use the red, empty square as a marker with the solid line. (b) Plot both the high and low temperature for 7 days as a function of day in the same plot. Use the red, empty square as a marker with the solid line for high temperature, and blue, empty circle as a marker with the dotted line for low temperature.
For Octave/Matlab
a)
Matlab Code:
day = [ 1 2 3 4 5 6 7];
High_temp = [30 32 34 29 31 30 25];
Low_temp = [25 26 23 20 19 21 18];
plot(day,High_temp,'-s','MarkerSize',10,...
'MarkerEdgeColor','red',...
'MarkerFaceColor','red')
xlabel('Day');
ylabel('Temperature');
b) .
Matlab Code:
day = [ 1 2 3 4 5 6 7];
High_temp = [30 32 34 29 31 30 25];
Low_temp = [25 26 23 20 19 21 18];
plot(day,High_temp,'-s','MarkerSize',10,...
'MarkerEdgeColor','red',...
'MarkerFaceColor','red')
hold on
plot(day,Low_temp,'-o','MarkerSize',10,...
'MarkerEdgeColor','blue',...
'MarkerFaceColor','none')
legend('High temperature','Low temperature')
xlabel('Day');
ylabel('Temperature');