% PLOTWHEAT reads wheat.csv file with wheat data % from http://www.globalfindata.com/ % % To make it more stationary: % 1) Take logarithm of data, % 2) Detrend the data. % % (This is stored in matlab file wheat.mat) % % 20040202 Anders Malmberg M = csvread('wheat.csv',1,1); M = M(1:end-2,:); % high, low, close logM = log(M); % use a rather long MA-filter inorder not % to remove too much of the low frequencies [data,trend] = detrendma(logM(:,3),20); year = 1:size(M,1); year = 1840+year; plot(year,logM(:,3),'r',year,data,'k',year,trend,'m') title('Wheat prices') xlabel('Year') ylabel('log(US Dollars/Pound)') legend('Wheat Cash Price','Detrended','Trend') grid on