2012-10-06 81 views
1

我在matlab中做了一些矩陣計算。什麼看起來很奇怪(對我來說)是我得到如下結果:簡化矩陣matlab

(8700286382685973*cos(q5)*sin(q4))/9007199254740992 + sin(q5)*((43220913799951902644522757965203*cos(q4))/730750818665451459101842416358141509827966271488 - 291404338770025/1125899906842624) 

但matlab並沒有簡化結果。我已經嘗試過使用像simplify,simple,fix這樣的功能,但是他們都沒有給出想要的結果。

任何關於我應該使用哪個函數的建議?

+0

如何ÿ你知道它可能更簡單嗎?除了「我認爲是這樣」? – duffymo

+0

因爲'43220913799951902644522757965203/730750818665451459101842416358141509827966271488'幾乎爲0. – Saphrosit

+0

好的,所以你只剩下第一個任期。那些常數對我來說也是可疑的。你是如何得出這個結果的?什麼是後面的故事? – duffymo

回答

1

作爲@Lucas建議,可以使用VPA和數字在MATLAB中,例如,如果上述表達式爲A(符號),那麼:

vpa(A,3) % digits is set to 3 

ans = 

    0.966*cos(q5)*sin(q4) + sin(q5)*(5.91e-17*cos(q4) - 0.259) 

然後就可以看到數字本身和印章他們,或使用類似:

function result = significant(x, n) 
% significant(x, n) rounds number x to n number of significant figures 

s = floor(log10(abs(x))); 
shift = 10^(n-1); 
mant = round(x*shift/(10^s))/shift; 
result = mant * 10^s; 
2

簡化只做「精確」操作。你需要的是一個殺死你的表情中的小項的命令。在Mathematica中,「Chop」負責處理這個問題。嘗試谷歌它。

0

嘗試做這些命令之一的評估之前:

format longe 
format shorte