function DS = deadstates_fsa(M) % DS are the "dead" states of the FSA M DS = []; for q=M.Q Mq = M; Mq.q0 = q; Mq = remove_unreachable(Mq); if empty_fsa(Mq) DS(end+1) = q; end end DS = setdiff(DS,M.q0); %q0 is always reachable return