fareen
Full Member level 3
hi
im having a lot of troble in writing matlab code
specially in defing a function
can any body help??
im having a lot of troble in writing matlab code
specially in defing a function
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 fu=function define in another function file. function [bs] = bisection(fu, xl,xu,tol,n) error=0; t=0; while t <= n | error < tol bs= xl+ (xu-xl)/2; if (fu(xl)*fu(bs))<0 bs=xu; elseif (fu(xu)*fu(bs))<0 bs=xl; else (feval(fu,xl)*feval(fu,bs))==0; break end error = (bs(t-1)-bs(t))/bs(t); if error < tol break end t=t+1; end end function f=fu(x) x=0:10; f=x.^3+4*x-10; end
can any body help??
Last edited by a moderator: