Analysis and design of passive and active microstrip reflectarrays