Need help creating a function m-file for the bisection method for the following equation...
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Oliver Jones
il 15 Dic 2013
Commentato: Rothanak
il 9 Giu 2023
I'm really stuck on an assignment that regards the bisection method. This is due to me missing all of my lectures for the module because I have transferred course from Chemical to Mechanical Engineering. I can't get help from within the University as it is outside of term-time now and I am back home.
I am having great difficulty with the following task for which I have been given these values:
k = 1; n = 0.6833; U = 1.0714; Pgrad = -3.333333.....
I am then given the following equation defining the pressure gradient in a pipe of radius 'R' (the only unknown in the equation):
Pgrad = -2k * ( ( U * (3n + 1) ) / ( n * R ^ (1 + 1/n) ) ) ^ n
Use the bisection method to determine an approximate value of R, with an absolute error of less than 1 x 10^-6.
I'm not expecting someone to come up with the whole m-file or anything, but any help whatsoever would be greatly appreciated. I've spent hours and hours trying to catch up with where I should be on the course and even resorted to watching videos on Youtube to see if any could help.
Even if people could just try and point me in the right direction.
Thanks
(Here is the question from the actual assignment sheet)

1 Commento
Rothanak
il 9 Giu 2023
Find the value of 3: a. Write in file M file of it define function. b. Find the root using bisection method in interval [1,2].
Risposta accettata
Roger Stafford
il 15 Dic 2013
I recommend you carefully read the Wikipedia article at:
http://en.wikipedia.org/wiki/Bisection_method
The method requires that you first find two values a and b such that the function f(R ) whose root you are attempting to find has opposite signs for f(a) and f(b). For that purpose I advise you to make a plot of your f(R ) with varying R so you can see approximately where it crosses the zero point and thus how to set those initial starting values for a and b. For your looping until the error is less than 1e-6, you will need to use matlab's 'while' command to continue until that condition is satisfied. The above article gives a fairly clear description of how to proceed within the while-loop.
In Mathworks' File Exchange there are several contributions whose codes could possibly guide you to a solution if you get desperate. See the list at:
http://www.mathworks.com/matlabcentral/fileexchange/index?term=bisection&utf8=✓
3 Commenti
siti bahari
il 18 Mag 2016
Hello there
why can't we use the given value of n, U and Pgrad instead of calculating it?
Più risposte (1)
Walter Roberson
il 15 Dic 2013
fun = @(R) -2k * ( ( U * (3n + 1) ) / ( n * R ^ (1 + 1/n) ) ) ^ n - Pgrad
now apply the bisection method to find the R such that fun® = 0
Hint: there is an analytic solution, which is
R = exp((ln(U*(3*n+1)/n)*n-ln(-(1/2)*Pgrad/k))/(n+1))
To as many decimal places as your provide,
R = (20/22776664389) * 7^(6833/16833) * 11^(6833/16833) * 487^(6833/16833) * 4357^(6833/16833) * 2^(15835/16833) * 5^(15835/16833) * 6833^(10000/16833) * 3^(6833/16833) * 239^(6833/16833) * 4649^(6833/16833)
0 Commenti
Vedere anche
Categorie
Scopri di più su Particle & Nuclear Physics in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!