Optimal H_2 and H_infty Controllers for Periodic and Multirate Sampled Systems