% 1.731 Irrigation rainfall-streamflow example function AR % load rainfall sequence load precip.dat; n=length(precip) q(1)=1 % for loop steps through precipitation for t=1:n q(t+1)=0.8*q(t)+0.2*precip(t); end q close all figure subplot(2,1,1) bar(0.5:n-0.5,precip,1) axis([0 20 0 3]) subplot(2,1,2) plot(0:n,q) axis([0 20 0 2]) return