作者diva ( )
看板MATLAB
標題Re: [繪圖] 方程式繪圖問題
時間Sat Mar 10 22:44:07 2012
你要的是不是類似這種結果
假設你的方程式是
y=x^3+2*x^2-10*x+10
圖形為
http://imgur.com/BysVz
要用迭代的方法找y=0的解
opts=optimset('display','iter','tolx',0.2) ;
^^^^^^^^^^^^^^^ ^^^^^^^^^
顯示迭代結果 tolerance <=0.2
fzero('x^3+2*x^2-10*x+10',10,opts) ;
^^
從10開始找
結果為
Search for an interval around 10 containing a sign change:
Func-count a f(a) b f(b) Procedure
1 10 1110 10 1110 initial
3 9.71716 1019.2 10.2828 1205.92 search
5 9.6 983.056 10.4 1247.18 search
7 9.43431 933.383 10.5657 1307.1 search
9 9.2 865.968 10.8 1394.99 search
11 8.86863 776.159 11.1314 1525.76 search
13 8.4 659.824 11.6 1724.02 search
15 7.73726 515.55 12.2627 2032.13 search
17 6.8 348.912 13.2 2526.45 search
19 5.47452 179.269 14.5255 3351.45 search
21 3.6 46.576 16.4 4794.86 search
23 0.949033 3.16576 19.051 7459.71 search
25 -2.8 31.728 22.8 12674 search
26 -8.10193 -309.52 22.8 12674 search
Search for a zero in the interval [-8.10193, 22.8]:
Func-count x f(x) Procedure
26 -8.10193 -309.52 initial
27 -4.86116 -9.00013 interpolation
28 -4.86116 -9.00013 interpolation
Zero found in the interval [-8.10193, 22.8]
這是你要的嗎?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.103.220
※ 編輯: diva 來自: 140.112.103.220 (03/10 22:44)
推 luckykey:大大你好強! 我欠你一杯飲料 85度C乙張兌換卷送你! 03/10 22:48
→ luckykey:我會研究一下你的寫法! 方程式只是舉例! 03/10 22:49
推 luckykey:不過你的方程式是多項式 我要找x=x.^-2+1/x-1之類的 03/10 22:56
→ diva:x=x.^-2+1/x-1 這也是多項式啊 不然改成 y=x^-2+1/x-1-x 03/11 09:26
→ diva:不過不一定會跑出結果 不一定所有的多項式都有解 03/11 09:27
→ diva:我指的是實數解 03/11 09:27