Create a Time-Variable Dc Power Source
It sounds like you want a power supply that can be controlled externally. Fortunately, these exist, and they are called programmable power supplies. You can connect a laptop to them and send them commands using MATLAB or another scripting language through a GPIB interface. For example check out these power supplies, and this GPIB cable. 

The company I work at uses a lot of programmable instruments combined with MATLAB to automate hardware tests.