The linearly polarized undulator for the single stage free electron laser (FEL) experiment at UCSB is made of cobalt-samarium permanent magnets. It can provide a maximum field of 850 G on axis with ±2% uniformity. Numerical simulation of the electron beam transport through the undulator shows strong focusing betatron oscillations in the vertical direction. In the horizontal plane, typical beam trajectories have fluctuating amplitudes comparable to the laser beam radius. As a result of this, the laser gain is reduced by 30%. Numerical analysis of the bandwidth broadening of the spontaneous emission is discussed. Field imperfection in the undulator reduces electron beam recovery, which also reduces laser gain. With a maximum recovery rate of 97%, the gain is reduced by 1% due to electron beam energy shift. It can be reduced more with less recovery rate.