SHOW:
|
|
- or go back to the newest paste.
| 1 | function weatherplot() | |
| 2 | %%%%%%%%%%%%%%%%%%%%%% | |
| 3 | %Benjamin Buxton | |
| 4 | %Date:: 28/04/12 | |
| 5 | %Input::None | |
| 6 | %Output:: Screen (+graph) | |
| 7 | %This program loads weather data as an ascii text file in a specific format of a specific directory and plots average wind speed and average gust speed against days for a period | |
| 8 | %%%%%%%%%%%%%%%%%%%%%% | |
| 9 | ||
| 10 | weatherDat=load('C:\Users\Ben\Documents\School\2012\SciComputing\Ex6\PerthWeatherDataApril08.txt');
| |
| 11 | ||
| 12 | numRows=size(weatherDat,1); | |
| 13 | dayNum=weatherDat(1:1:numRows, 1); | |
| 14 | avWindSpeed=weatherDat(1:1:numRows,4); | |
| 15 | gustSpeed=weatherDat(1:1:numRows,5); | |
| 16 | ||
| 17 | plot(dayNum, avWindSpeed) | |
| 18 | hold on | |
| 19 | - | plot(dayNum, gustSpeed) |
| 19 | + | plot(dayNum, gustSpeed,'r') |
| 20 | title('Average Wind Speed and Maximum Gust Speed per day')
| |
| 21 | xlabel('Day Number')
| |
| 22 | ylabel('Speed (km/h)')
| |
| 23 | legend('Average Wind Speed = Blue, Maximum Gust Speed = Red') |