updated to logspace and fixed some syntax