Regulate VIN

Is it possible to regulate the VIN pin of arduino ? for example...

if the power supply of the arduino is 9V Battery can i regulate it somehow with code to output 5V or 7V (in other words based on the amount of volts chose)

thank you for ur time

No. Vin only goes to the input of the fixed 5V regulator.