Try putting some delay in between these reads
solarPanelVoltage = analogRead(solarV);
vout = (solarPanelVoltage * 5.0) / 1024.0;
vin = vout / (R2/(R1+R2));
batteryVoltage = analogRead(batteryV);
vout1=(batteryVoltage * 5.0) / 1024.0;
vin1= vout1 / (R22/(R11+R22));
You may be running into this, section 23 of the datasheet, we can't say for sure as no schematic has been posted:
"The analog input circuitry for single ended channels is illustrated in Figure 23-8. An analog
source applied to ADCn is subjected to the pin capacitance and input leakage of that pin, regardless
of whether that channel is selected as input for the ADC. When the channel is selected, the
source must drive the S/H capacitor through the series resistance (combined resistance in the
input path).
The ADC is optimized for analog signals with an output impedance of approximately 10 kΩ or
less. If such a source is used, the sampling time will be negligible. If a source with higher impedance
is used, the sampling time will depend on how long time the source needs to charge the
S/H capacitor, with can vary widely. The user is recommended to only use low impedance
sources with slowly varying signals, since this minimizes the required charge transfer to the S/H
capacitor.
Signal components higher than the Nyquist frequency (fADC/2) should not be present for either
kind of channels, to avoid distortion from unpredictable signal convolution. The user is advised
to remove high frequency components with a low-pass filter before applying the signals as
inputs to the ADC."