Current hysteresis loop matlab simulation