working matlab sim for one variable