An analysis of resistance spot welding