Solving surface plasmon resonances and near field in metallic nanostructures: Green’s matrix method and its applications