function baiduwenti(a)
s=0
k=0
zi=size(a)
zj=zi(1)-zi(2)
if zj~=0
disp('error')
else
zi=zi(1)
for zj=1:zi
if zj==1
k=a(1,zj)*baiduwenti(a([2:zi],a[2:zi]))
elseif zj==zi
k=a(1,zj)*baiduwenti(a([2:zi],a[1:zi-1]))
else
k=a(1,zj)*baiduwenti(a([2:zi],a[1:zj-1,zj+1:zi))
endif
s=s+k
end
endif
没有调试过 希望你能参考一下