how to plot winter rainfall data with trend line
6 ビュー (過去 30 日間)
古いコメントを表示
1977-78 17,
1978-79 29,
1979-80 8,
1980-81 4,
0 件のコメント
回答 (1 件)
dpb
2015 年 10 月 11 日
y=[78:81].';r=[17 29 8 4].';
plot(y,r)
b=polyfit(y,r,1);
rhat=polyval(b,y);
hold on,plot(y,rhat,'r')
set(gca,'xtick',y)
xlim([y(1)-0.5 y(end)+0.5])
set(gca,'xticklabel',num2str([y-1 y]+1900,'%d-%d'))
xlabel('Winter Season of')
ylabel('Season rainfall (in)')
Salt to suit...
4 件のコメント
dpb
2015 年 10 月 12 日
That's the comment I made earlier re: using 2-yr vis a vis 4-yr dates. "Exercise for the student..." :)
Decide what you want the labeling to be and then figure out the formatting to produce that. You could simply start with using y1 alone but it should be obvious that adding 1900 to an already-four-year value isn't going to be what you want.
参考
カテゴリ
Help Center および File Exchange で Christmas / Winter についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!