The motorcycles with the controlling valves in the exhaust such as the Honda HVIX & (HTEV™) system and Yamaha EXUP system vary collector performance (right after the headers) to minimize exhaust backpressure at different rpm's for a broader power band, 1nvolving pressure waves.
The other exhaust sytem valve by Honda (CB1300 Super Four) mounted at the end of the muffler is for sound purposes.
Pressure waves, the effects of Bernoulli's principle, Helmholtz resonantors, surge suppressors, and other gas/fluid flow characteristic are like magic sometimes.