我無法解決Scilab中的問題,因爲它由於舍入錯誤而陷入困境。我得到的消息Scilab舍入錯誤
!--error 9999
Error: Round-off error detected, the requested tolerance (or default) cannot be achieved. Try using bigger tolerances.
at line 2 of function scalpol called by :
at line 7 of function gram_schmidt_pol called by :
gram_schmidt_pol(a,-1/2,-1/2)
它是一種革蘭氏施密特過程有兩個函數的乘積的積分和重量標產品,-1和1 gram_schmidt_pol
是專爲polynome設計的過程中,和之間scalpol
是針對polynome描述的標量積。
的a
和b
是用於weigth,這是(1+x)^a*(1-x)^b
該條目是表示一組向量的矩陣的參數,它與基質[[1;2;3],[4;5;6],[7;8;9]]
效果很好,但它無法與基體中的上述消息錯誤eye(2,2)
,除此之外,我需要在眼睛上做(9,9)!
我已經在菜單中尋找「容差設置」,有一些在General->Preferences->Xcos->Simulation
,但我相信這不是我想要的,我已經嘗試過低設置(高容忍度),並且它沒有'不改變任何事情。
那麼,我該如何解決這個問題?
隨時告訴我我的消息缺乏清晰度。 謝謝。
編輯:代碼的功能:
// function that evaluate a polynomial (vector of coefficients) in x
function [y] = pol(p, x)
y = 0
for i=1:length(p)
y = y + p(i)*x^(i-1)
end
endfunction
// weight function evaluated in x, parametrized by a and b
// (poids = weight in french)
function [y] = poids(x, a, b)
y = (1-x)^a*(1+x)^b
endfunction
// scalpol compute scalar product between polynomial p1 and p2
// using integrate, the weight and the pol functions.
function [s] = scalpol(p1, p2, a, b)
s = integrate('poids(x,a, b)*pol(p1,x)*pol(p2,x)', 'x', -1, 1)
endfunction
// norm associated to scalpol
function [y] = normscalpol(f, a, b)
y = sqrt(scalpol(f, f, a, b))
endfunction
// finally the gram schmidt process on a family of polynome
// represented by a matrix
function [o] = gram_schmidt_pol(m, a, b)
[n,p] = size(m)
o(1:n) = m(1:n,1)/(normscalpol(m(1:n,1), a, b))
for k = 2:p
s =0
for i = 1:(k-1)
s = s + (scalpol(o(1:n,i), m(1:n,k), a, b)/scalpol(o(1:n,i),o(1:n,i), a, b) .* o(1:n,i))
end
o(1:n,k) = m(1:n,k) - s
o(1:n,k) = o(1:n,k) ./ normscalpol(o(1:n,k), a, b)
end
endfunction
是的,我編輯帖子 –