Undefined function or variable 'Untitled'.

7 ビュー (過去 30 日間)
Abdelmoniem Abomosalam
Abdelmoniem Abomosalam 2018 年 4 月 15 日
コメント済み: Geoff Hayes 2018 年 4 月 15 日
http://nm.mathforcollege.com/strippedfiles/mws/che/03nle/mws_che_nle_txt_newton_examples.pdf I want to solve the question provided in the link by performing Newton's method (3 iteration in addition to the relative error with each iteration)

回答 (1 件)

Geoff Hayes
Geoff Hayes 2018 年 4 月 15 日
Abdelmoniem - I'm not sure how the error message Undefined function or variable 'Untitled' fits in with your code since I don't see "Untitled" anywhere in it. Perhaps this is the name of your m-file?
As for the line
f = input(...
what are you attempting to do here? Is f supposed to be a function? If so, then I suggest you look at anonymous functions and consider changing its assignment to
f = @(x)(x^3)-9*(x^2)+3.197;
(and do the same for fdiff).
  2 件のコメント
Abdelmoniem Abomosalam
Abdelmoniem Abomosalam 2018 年 4 月 15 日
MATLab displays Undefined function or variable 'x' in line 22 of the Code posted above. Yes f is supposed to be a function of x. I edited the function and its first deriviatve code and still its not working.
Geoff Hayes
Geoff Hayes 2018 年 4 月 15 日
So what is the name of your m-file? Is it "Untitled44.m" or "Untitled 44.m" where there is a space in the name? If the latter, then please rename the space from the file name and then run as
>> Untitled44
Note also that in your code, you are still referencing input. Please replace this with f.
Also, the line 22 is end so I'm not sure why there would be an error message indicating that x is undefined at this line.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeScripts についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by