Question
How do I solve this error and make the program work? function [] = Newton(f, x1, tol, N) % % Newton uses Newtons method to
How do I solve this error and make the program work?
function [] = Newton(f, x1, tol, N) % % Newton uses Newtons method to approximate a root of f(x) = 0. % % [r, n] = Newton(f, x1, tol, N), where % % f is a symbolic function representing f(x), % x1 is the initial point, % tol is the scalar tolerance for convergence (default 1e-4), % N is the maximum number of iterations (default 20), % % r is the approximate root of f(x) = 0, % n is the number of iterations required for convergence. % if nargin MAE305. mx + function [] = Newton (f, xl, tol, N) Newton uses Newton's method to approximate a root of f(x) = 0. [r, n] = Newton (f, xl, tol, N), where % f is a symbolic function representing f(x), xl is the initial point, % tol is the scalar tolerance for convergence (default le-4), % N is the maximum number of iterations (default 20), fr is the approximate root of f(x) = 0, MAE305.m x + r is the approximate root of f(x) = 0, n is the number of iterations required for convergence. if nargin > MAE 305 (@(x) (x^2-5*x+4), 10, .0001, 20) Error using deal (line 37) The number of outputs should match the number of inputs. Error in symengine> (x) deal (x.*-5.0+x.^2+4.0,x). Error in MAE305 (line 30) x(n+1) = x(n) - f(x(n))/fp (x(n)); f >> |
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