Microwave spectroscopy and magnetization measurements of flux trapping and hysteresis in YBa2Cu3O7−δ