MATLAB Code of Newton-Raphson method for root finding

  Рет қаралды 28,191

Dr. Harish Garg

Dr. Harish Garg

Күн бұрын

Пікірлер: 18
@stergiostziahanas6532
@stergiostziahanas6532 2 ай бұрын
Made some modifications, hope this helps.. format short syms x % Define the function and its derivative f = @(x) x*log10(x) - 1.2; df = matlabFunction(diff(f(x), x)); % Convert symbolic derivative to function % Initial guess and parameters x0 = 1.5; n = 6; iter = 1; err = abs(f(x0)); epsilon = 5 * 10^(-n - 1); itermax = 70; % Array to store iteration data HG = []; % Check if the derivative at initial guess is non-zero if abs(df(x0)) < 10^(-9) disp('Wrong choice of initial Guess'); else % Newton-Raphson iteration while (iter epsilon) x1 = x0 - f(x0) / df(x0); err = abs(f(x1)); % Update error with new x1 value HG = [HG; iter, x0, f(x0), err]; % Append current iteration data iter = iter + 1; x0 = x1; % Update x0 for next iteration end end % Display results disp('====='); disp('Output Table with Iteration-wise Results'); % Convert results to table with column names Result = array2table(HG, 'VariableNames', {'Iteration', 'x', 'f(x)', 'Error'}); disp(Result); % Round solution to n decimal places x0 = round(x0, n); fprintf('Converged solution after %d iterations ', iter - 1); fprintf('Root is %2.*f ', n, x0);
@jaffarlone8378
@jaffarlone8378 3 жыл бұрын
Dear Sir, Your lectures are really very helpful. Please upload the videos on the MATLAB implementation of Descent Methods.
@jacobjacob3687
@jacobjacob3687 Жыл бұрын
Appreciate much Dr Harish ,,,, God bless u ,, you have been help me so much ,,,, 🙏🙏👍👍
@yaoxie3531
@yaoxie3531 2 жыл бұрын
An advice to improve the algorithm. The IF condition should be "abs(dfx(x0))
@zainabakram1543
@zainabakram1543 Жыл бұрын
sir i need the code for an ODE by using newton raphson method. can you give me?
@PradeepKumar-eh1jr
@PradeepKumar-eh1jr 3 жыл бұрын
This code is not running in my system.
@JARRARAHMED1
@JARRARAHMED1 2 жыл бұрын
Same
@hutheifa4880
@hutheifa4880 2 жыл бұрын
Thank you dr. .... I have a question; does the value of roots changes if we use different value for the initial point?
@DrHarishGarg
@DrHarishGarg 2 жыл бұрын
No
@hutheifa4880
@hutheifa4880 2 жыл бұрын
@@DrHarishGarg I have found a matlab code that finds the roots of two functions of two variables by using Newton Method. I know that for quadratic equation the roots should be two values; one +ve and one -ve of the same root value. This can be noticed with using different initial values. Thats why I raised my question earlier. However, how could we let the matlab code shows the both values without plotting. Hope my question is clear.
@DrHarishGarg
@DrHarishGarg 2 жыл бұрын
That's called as multiple roots of f(x)
@sumitsana6170
@sumitsana6170 2 жыл бұрын
How can I write this code in "c"?
@McPlaySpot
@McPlaySpot 3 жыл бұрын
Thank you Dr.
@DrHarishGarg
@DrHarishGarg 3 жыл бұрын
My pleasure dear
@vivekmehta6833
@vivekmehta6833 3 жыл бұрын
@@DrHarishGarg Hey! I'm a Freelancer and I do have pirated versions of the softwares. And I was planning to make videos on mechanical softwares like MATLAB, Solidworks, AutoCAD, etc on KZbin. Like how to design a particular thing or how to write a code for a particular problem. All these softwares cost 1000s of dollars a year for individual/commercial license which obviously I can't afford. If you could help me out with a few questions, I would be really grateful of you!!! 1) When I apply for monetization, will I be asked whether I have commerical licenses of the aforementioned softwares by KZbin? 2) If KZbin doesn't ask for commercial licenses and after that my content is monetized, at what point can I expect these companies to send me a notice regarding the licenses? At 10k subscribers? 50k? 100k? 3) How much money do KZbinrs with 10-50k subscribers from 3rd world countries like India get monthly? Any idea? 4) Is it really worth it? I mean I do have the skills and knowledge but I honestly don't think I would be able to afford these softwares until and unless I start earning 500-1000$ per month via KZbin.
@kashafiftikhar1314
@kashafiftikhar1314 2 жыл бұрын
Please sir code de dein Ricci tensor ka lea
@nikolai7548
@nikolai7548 3 жыл бұрын
Thanks sir.
@hometutionacademybygowhers9594
@hometutionacademybygowhers9594 3 ай бұрын
Best
Newton's Raphson Method | System of Nonlinear equations
34:02
Dr. Harish Garg
Рет қаралды 3,7 М.
Newton's method (introduction & example)
20:53
blackpenredpen
Рет қаралды 215 М.
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН
UFC 310 : Рахмонов VS Мачадо Гэрри
05:00
Setanta Sports UFC
Рет қаралды 1,2 МЛН
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН
MATLAB Code of Bisection Method for Root Finding
13:28
Dr. Harish Garg
Рет қаралды 36 М.
Newton-Raphson Method and Examples - Part 1
28:55
Dr. Harish Garg
Рет қаралды 12 М.
Newton-Raphson Method | Numerical Computing in Python
17:31
mechtutor com
Рет қаралды 61 М.
Fast Inverse Square Root - A Quake III Algorithm
20:08
Nemean
Рет қаралды 5 МЛН
Newton Raphson Method and Order of Convergence
18:15
Dr. Harish Garg
Рет қаралды 12 М.
Newton's Method | Lecture 14 | Numerical Methods for Engineers
10:21
Jeffrey Chasnov
Рет қаралды 76 М.
The Basic Newton Method in MATLAB
7:47
Christi Patton Luks
Рет қаралды 90 М.
How a Blind Mathematician Became the World's Greatest
16:31
Newsthink
Рет қаралды 238 М.
approximate 4th root of 75, Newton's Method, calculus 1 tutorial
5:55
bprp calculus basics
Рет қаралды 68 М.
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН