Answered step by step
Verified Expert Solution
Question
1 Approved Answer
im trying to write a matlab code that asks to input a function in terms of x and then the code takes the derivative of
im trying to write a matlab code that asks to input a function in terms of x and then the code takes the derivative of that function. This is the highlighted part that I am having trouble with. I believe the rest is correct. thank you.
5 APPS EDITOR PUBLISH VIEW ind Files Insert fx 21. Run Section Compare Co To Comment Breakpoints Run Run and Advance Run and Print F ind Indent Time NAVIGATE BREAKPOINTS Users stephenlea Desktop CIV312 Matlab Project Files Editor - /Users/stephenlea/Desktop/CIV312 Matlab Project Files/Newton Raphson Method.m CalculateEc. mx CalculatePhim XCIV312 Concrete BeamSolver. m x Document. mx Calculatel. mx bisectionfunctie The Newton Raphson Method EDIT Newton Syns x 0 Input('Enter the LHS of the function in terms of x:'); f = @(x) 9: The Colebrook equation as a function equal to zero fprine = eval(['(x)' char(diff(f(x))))); The derivative off Ngprime input('Enter the dx of the LHS of the function i'); fprime = @(x) gprime x = @; 1 = 0; ei = 1; Initial Guess Starting the number of iterations Begins while loop, ei- 1-1-1 e while (ei > le-5) xnew-X- (f/fprime); ei = abs(x-xnew); xnew; Updates x value 1=1 .1; Updates iteration X end fprintf("The Root is : f ',x) fprintf('No. of Iterations : d ', i) fprintf('ei value is : d ',ei) ommand Window end fprintf('The Root is : f ',x) fprintf('No. of Iterations : d ',1) fprintf("ei value is : d ',ei) Enter the LHS of the function in terms of xi((-0.0000251/sqrt(x))-0.0002)/(2ex(3/2)*(0.0000251/sqrt(x)+0.00018) Undefined operator '/' for input arguments of type 'function_handle'. is action in arguments Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started