tag:blogger.com,1999:blog-809164996868407424.post6573722535323602853..comments2023-12-12T08:03:39.993-08:00Comments on Computational Physics: MATLAB - False Position Methodmghttp://www.blogger.com/profile/17389270050642663796noreply@blogger.comBlogger15125tag:blogger.com,1999:blog-809164996868407424.post-76011026129032943252017-03-23T20:32:15.463-07:002017-03-23T20:32:15.463-07:00xn-((equan(xn)*(xp-xn)/(equan(xp)-equan(xn))is rig...xn-((equan(xn)*(xp-xn)/(equan(xp)-equan(xn))is right. What I used is derived from this itself. Take common denominator and simplify. You will get the formula that I used.mghttps://www.blogger.com/profile/17389270050642663796noreply@blogger.comtag:blogger.com,1999:blog-809164996868407424.post-62119303700555705492017-03-23T07:44:26.869-07:002017-03-23T07:44:26.869-07:00For getting xm, can we use the formula xn-(equan(x...For getting xm, can we use the formula xn-(equan(xn)-(xp-xn)/(equan(xp)-equan(xn)))?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-809164996868407424.post-73188484299478881582017-03-23T07:40:41.075-07:002017-03-23T07:40:41.075-07:00Is it not the formula xn-((equan(xn)-(xp-xn)/(equa...Is it not the formula xn-((equan(xn)-(xp-xn)/(equan(xp)-equan(xn)) the formula in getting xm or is your formula derived from that formula? Or maybe an alternative formula. I'm confused to what formula am i going to use when i only know the formula given to us by our school proffesors. Thats all ty.Kidfromphhttps://www.blogger.com/profile/08985948316328466532noreply@blogger.comtag:blogger.com,1999:blog-809164996868407424.post-45841421437786367972016-05-11T10:52:10.224-07:002016-05-11T10:52:10.224-07:00clc
clear all
syms x
f=inline(input('enter t...clc<br /> clear all<br /> syms x<br />f=inline(input('enter the equation:','s'))<br /> <br />i=1;<br />while(i)<br /> xl=input('Enter lower value:');<br /> xu=input('Enter upper value: ');<br /> e=input('Enter accuracy: ');<br /> if f(xl)*f(xu)<0<br /> i=0;<br /> else<br /><br /> display('root not located between the entered values');<br /> end<br />end<br />if f(xl)<0<br /> xn=xl;<br /> xp=xu;<br />else<br /> xn=xu;<br /> xp=xl;<br />end<br /><br />xm=xl;<br />t=1;<br />while (abs(f(xm))>e)<br /> xm=(xn*f(xp)-xp*f(xn))/(f(xp)-f(xn));<br /> fprintf('%d)\tx%d=%f\n',t,t,xm)<br /> t=t+1;<br /> <br /> if f(xm)<0<br /> xn=xm;<br /> else<br /> xp=xm;<br /> end<br />end<br /><br />Root=xm<br /><br /><br />please use this code instead to find out roots for any expression.. just enter an equation with proper syntax in the command window. e.g enter the expression like this when asked x^2+x-2 . the results will be shown in table formAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-809164996868407424.post-62918277426097879442016-02-11T08:10:07.531-08:002016-02-11T08:10:07.531-08:00Yes. It can be...Yes. It can be...mghttps://www.blogger.com/profile/17389270050642663796noreply@blogger.comtag:blogger.com,1999:blog-809164996868407424.post-55190449078545438062015-10-26T18:03:45.251-07:002015-10-26T18:03:45.251-07:00Can this method be used for another function>Can this method be used for another function>Anonymoushttps://www.blogger.com/profile/06340172207844967382noreply@blogger.comtag:blogger.com,1999:blog-809164996868407424.post-13218968005041709982015-10-26T18:02:41.386-07:002015-10-26T18:02:41.386-07:00Could this method be used for any other function?Could this method be used for any other function?Anonymoushttps://www.blogger.com/profile/06340172207844967382noreply@blogger.comtag:blogger.com,1999:blog-809164996868407424.post-77440480372431983442015-10-26T18:02:13.830-07:002015-10-26T18:02:13.830-07:00Can this method be used for another function>Can this method be used for another function>Anonymoushttps://www.blogger.com/profile/06340172207844967382noreply@blogger.comtag:blogger.com,1999:blog-809164996868407424.post-83358286935646327562014-04-08T20:47:38.931-07:002014-04-08T20:47:38.931-07:00Hi
create a file equan.m and copy the following li...Hi<br />create a file equan.m and copy the following lines to it & save.<br /><br />% Equation to be solved<br />function[eqn]=equan(x);<br />eqn=x^2+x-2;<br /><br />Now run false position. It should work. The function is defined in equan.m file and it is called in the present code. Since it is already mentioned in bisection code (see code page), I didn't mention that in this page.<br />Thanks for intimating the problem.mghttps://www.blogger.com/profile/17389270050642663796noreply@blogger.comtag:blogger.com,1999:blog-809164996868407424.post-87289743341669700502014-04-08T02:08:03.061-07:002014-04-08T02:08:03.061-07:00Equation is x^2+x-2 = 0
Enter lower value:0
Enter ...Equation is x^2+x-2 = 0<br />Enter lower value:0<br />Enter upper value: 9<br />Enter accuracy: 1e-4<br />??? Undefined function or method 'equan' for input arguments of type 'double'.<br /><br />im entering these values and getting this error....Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-809164996868407424.post-62017938085239225252013-09-12T11:55:30.787-07:002013-09-12T11:55:30.787-07:00hi is there any truncation of iteration criteria?...hi is there any truncation of iteration criteria?<br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-809164996868407424.post-3261271413251838062013-01-27T22:47:01.333-08:002013-01-27T22:47:01.333-08:00Hi
create a file equan.m and copy the following li...Hi<br />create a file equan.m and copy the following lines to it & save.<br /><br />% Equation to be solved<br />function[eqn]=equan(x);<br />eqn=x^2+x-2;<br /><br />Now run false position. It should work. The function is defined in equan.m file and it is called in the present code. Since it is already mentioned in bisection code (see code page), I didn't mention that in this page.<br />Thanks for intimating the problem.mghttps://www.blogger.com/profile/17389270050642663796noreply@blogger.comtag:blogger.com,1999:blog-809164996868407424.post-89697016109551429142013-01-27T22:14:06.340-08:002013-01-27T22:14:06.340-08:00Dear Mr. Mahesha MG ,,,,
I am not getting output a...Dear Mr. Mahesha MG ,,,,<br />I am not getting output after this programm it showing error as below.<br /><br />Error using ==> le<br />Not enough input arguments.<br /><br />Error in ==> Untitled2 at 12<br /> e=input('Enter accuracy: ');Anonymoushttps://www.blogger.com/profile/03779429662300736992noreply@blogger.comtag:blogger.com,1999:blog-809164996868407424.post-30216180509045370022012-12-25T02:56:07.371-08:002012-12-25T02:56:07.371-08:00if equan(xl)*equan(xu)<0
this statement makes s...if equan(xl)*equan(xu)<0<br />this statement makes sure that at lower value and upper value of x, function will have opposite signs. this is the 'must' condition for false position method. Once this condition is satisfied, 0 is assigned to i. So the while(i) loop ends.mghttps://www.blogger.com/profile/17389270050642663796noreply@blogger.comtag:blogger.com,1999:blog-809164996868407424.post-13658743075189330162012-12-20T06:38:26.422-08:002012-12-20T06:38:26.422-08:00if equan(xl)*equan(xu)<0
Doesn't that come...if equan(xl)*equan(xu)<0<br /><br />Doesn't that come up with an error?Anonymousnoreply@blogger.com