circa 70's-80's , I used to measure input impedance by using the scope X sweep out on the back to drive an FM input sweep generator then examine the envelope ratio on the scope for a linear frequency response.
I got fancier by using X sweep out into Channel 1 then use CH1 Out on back of scope to FM input on Sig Gen so I could adjust the sweep ramp voltage level and offset to select my start / Stop frequency.
Then I used sweep Ch1 Signal input to Gnd with vertical adjust to choose the range of Voltage and range of frequency for start and stop, then change probe input back to DC signal to use the same levels as the DC out using the scope to set the FM Gen frequency. Sounds complicated but it was easy for me.
I dont think DSO's have this feature now. I used this on all HP and Tek scopes. It was a great feature.
You can then add a series R box or 1M pot to scale your transfer function from the Generator 50 Ohms to 1 MOhm to get your impedance ratio where 50% Vout means Zin matches your source impedance.
- - - Updated - - -
To sweep over such a wide dynamic range of impedances would be impractical on a scope unless you chose to switch source impedances.
Is this for a production test or design verification?
Using a signal source at different frequencies, one can measure impedance by phase shift and amplitude reduction but you need a log scale in dB and log f like a spectrum analyzer to make that work. Or a Bode plot device. or an impedance analyzer.
But for design verification, a simple sig. gen and series R and scope will do.
FWIW, RLC meters use a constant current source sine wave at fixed frequencies to measure V as Z in amplitude and phase obviously with auto scaling on current, but limited in V and I to practical levels.