1> help bisection error: help: `bisection' not found 1> help bisection `bisection' is a function from the file C:\Documents and Settings\rudiger.achilles\desktop\bisection.m BISECTION Trova uno zero di una funzione. ZERO=BISECTION(FUN,A,B,TOL,NMAX) approssima uno zero della funzione FUN nell'intervallo [A,B] con il metodo di bisezione. FUN accetta come input uno scalare reale x e restituisce uno scalare reale. Se la ricerca dello zero di FUN fallisce, il programma restituisce un messaggio d'errore. FUN puo' essere una inline function, una anonymous function od una function definita in un M-file. ZERO=BISECTION(FUN,A,B,TOL,NMAX,P1,P2,...) passa i parametri P1, P2,... alla funzione FUN(X,P1,P2,...). [ZERO,RES,NITER]= BISECTION(FUN,...) restituisce il valore del residuo RES in ZERO ed il numero di iterazioni effettuate per calcolare il valore ZERO. Additional help for built-in functions and operators is available in the on-line version of the manual. Use the command `doc ' to search the manual index. Help and information about Octave is also available on the WWW at http://www.octave.org and via the help@octave.org mailing list. 2> f = inline('p*V.^3+a*N^2*V-a*b*N^3-p*N*V.^V.^2-1.3806488e-23*N*T*V.^2','V','a','b','p','N','T'); 3> plot([0,0.1], feval(f,[0,0.1],0.401,42.7e-6,3.5e7,1e3,300)); 4> grid on 5> f f = f(V, a, b, p, N, T) = p*V.^3+a*N^2*V-a*b*N^3-p*N*V.^V.^2-1.3806488e-23*N*T*V.^2 6> f = inline('p*V.^3+a*N^2*V-a*b*N^3-p*N*V.^2-1.3806488e-23*N*T*V.^2','V','a','b','p','N','T'); 7> plot([0,0.1], feval(f,[0,0.1],0.401,42.7e-6,3.5e7,1e3,300)); 8> f = inline('p*V.^3+a*N^2*V-a*b*N^3-p*N*V.^2*b-1.3806488e-23*N*T*V.^2','V','a','b','p','N','T'); 9> plot([0,0.1], feval(f,[0,0.1],0.401,42.7e-6,3.5e7,1e3,300)); 10> grid on 11> a = 0.02; b = 0.04; 12> tol = 5e-7 tol = 5.0000e-007 13> nmin = ceil(log2((b-a)/tol))) - 1 parse error: syntax error >>> nmin = ceil(log2((b-a)/tol))) - 1 ^ 13> nmin = ceil(log2((b-a)/tol)) - 1 nmin = 15 14> [z, res, iter] = bisection(f, a, b, tol, 100, 0.401,42.7e-6,3.5e7,1e3,300) error: Il segno della funzione agli estremi dell'intervallo [A,B] deve essere diverso error: called from: error: C:\Documents and Settings\rudiger.achilles\desktop\bisection.m at line 24, column 3 14> feval(f, a, 0.401,42.7e-6,3.5e7,1e3,300) ans = -9420.5 15> feval(f, b, 0.401,42.7e-6,3.5e7,1e3,300) ans = -1233.9 16> plot([0.02,0.04], feval(f,[0.02,0.04],0.401,42.7e-6,3.5e7,1e3,300)); 17> plot([0.04,0.06], feval(f,[0.04,0.06],0.401,42.7e-6,3.5e7,1e3,300)); 18> grid on 19> a = 0.040; b = 0.044; 20> [z, res, iter] = bisection(f, a, b, tol, 100, 0.401,42.7e-6,3.5e7,1e3,300) z = 0.042700 res = -0.13618 iter = 12 21> nmin = ceil(log2((b-a)/tol)) - 1 nmin = 12 22> printf('V = %.6f metri cubi = %.3f litri \n', z, 1000*z) V = 0.042700 metri cubi = 42.700 litri 23> printf('V = %.6f metri cubi = %.3f litri', z, 1000*z) V = 0.042700 metri cubi = 42.700 litri 24> printf('\n V = %.6f metri cubi = %.3f litri \n', z, 1000*z) V = 0.042700 metri cubi = 42.700 litri 25> p = 3.5e7; a = 0.401; b = 42.7e-6; k = 1.3806488e-23; N = 1000; T =300; 26> q = [p, -p*N*b-k*N*T, a*N^2, -a*b*N^3]; 27> roots(q) ans = 0.00000 + 0.10704i 0.00000 - 0.10704i 0.04270 + 0.00000i 28> quit