[問題] 程式已完成 想請問可以再多加些什麼進去??已回收

看板MATLAB作者 (不告訴你)時間16年前 (2009/11/04 17:36), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
%INPUT initial approximation p0;tolerance TOL;maximum number of iterations N0. %OUTPUT approximate solution p or message of failure. i=1; p0=input('A point p0:')%輸入你要的起始點 TOL=input('Set the tolerance:')%輸入你的誤差容忍度 N0=input('How many times you want to do:')%輸入你要計算的次數 h=input('A function:')%輸入一個函數 g=inline(h) while i<=N0 p=g(p0) if abs(p-p0)<TOL p break end i=i+1 p0=p end 想請問這個程式可以多加些什麼東西 讓他能夠再更好呢?? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.133.35.76
文章代碼(AID): #1AyKi0kS (MATLAB)