Optimal linear modeling and its applications on swing-up and stabilization control for Rotary Inverted Pendulum