The error is clear.....you are trying to extract more number of elements than present from an array.
Like wise, in you variables from the line:
check the dimensions of Es, x, sunElevation. Do they have any dimension of 89? Is x of dimension 4*89?
Did you define Es and initialize it?
The best way to check is learn debugging.