Basically what I'm trying to do is ask the user to input a function of x 'f(x)' then assign it as an anonymous function then have the user input what x value they would like the function to be evaluated at…
This code isn't complete, but heres what I have so far with the output it gives me:
function [] = NewtsMeth syms x l=input('Please enter f(x) = '); func=@(x) (l); Xest=input('Pleae enter an initial guess = '); k=func(Xest); d=diff(func,x) s=k end
output:
>> NewtsMeth Please enter f(x) = 6*x-8 Pleae enter an initial guess = 3 d = 6 s = 6*x - 8
Obviously this isn't Newton's method but I'm just trying to figure this input/evaluate part out.
Best Answer