You can produce a pulsating DC current source in Matlab by generating a square wave with a duty cycle less than 100%.
Here's the code that will produce a pulsating DC current source with an amplitude of 1 mA and at a frequency of 10 Hz:
main.m232 chars10 lines
You can adjust the duty cycle to change the on-to-off time ratio of the square wave, which determines the average DC value of the waveform. The amplitude of the pulsating DC current source is set by the scalar multiplier (1e-3 in this case).
gistlibby LogSnag