Analysis of electromagnetic fields and waves