duda matlab solution