Sensitivity analysis to unsteady perturbations of complex flows: a discrete approach