From: Siker on 17 Apr 2010 16:28 hi, that's the problem 0.015=(4+x)/(42-2x)^2*(30-x) and that's code i wrote %0.015=(4+x)/(42-2x)^2*(30-x) %x=-8:0.1:4; %y=((4+x)./(42-2.*x).^2).*(30-x)-0.015; %plot(x,y) %grid clc;clear; x0=-4; x1=-2; fonk=@(g) ((4+g)/((42-2*g)^2)*(30-g))-0.015; err=1; while err > 1e-2 x2=(x1+x0)/2; if feval(fonk,x2)*feval(fonk,x0)>0 x0=x2; else x1=x2; end hata=abs(feval(fonk,x2)); end root=x2 but command window doesn't react because it's busy :/
From: Siker on 17 Apr 2010 16:33 "Siker " <ugur.ersoy(a)msn.com> wrote in message <hqd5kl$lk1$1(a)fred.mathworks.com>... > hi, that's the problem > 0.015=(4+x)/(42-2x)^2*(30-x) > and that's code i wrote > > %0.015=(4+x)/(42-2x)^2*(30-x) > %x=-8:0.1:4; > %y=((4+x)./(42-2.*x).^2).*(30-x)-0.015; > %plot(x,y) > %grid > clc;clear; > x0=-4; > x1=-2; > fonk=@(g) ((4+g)/((42-2*g)^2)*(30-g))-0.015; > err=1; > while err > 1e-2 > x2=(x1+x0)/2; > if feval(fonk,x2)*feval(fonk,x0)>0 > x0=x2; > else > x1=x2; > end > hata=abs(feval(fonk,x2)); > end > root=x2 > > but command window doesn't react because it's busy :/ oh damn. i found problem :D
|
Pages: 1 Prev: alligning columns in a file Next: MatLab Kmeans and large data set |