improve analyze.m