derivitive matlab temp function

in matlab how would I ask the user to enter a starting guess V0 to use as the first value for the Newton-Raphson method. If this guess causes the derivative of the temperature function to be zero , the method will immediately fail due to a division by zero. Che

3 件のコメント

Aquatris
Aquatris 2020 年 2 月 25 日
You require an additional input to your function.
function y = fun(v,v0)
%The Newton Raphson Method
...
%check condition for division by 0
if statement == 0
error('Division by 0 detected, stopping the function');
end
% continue the method
...
end
What exactly is the problem you are running into?
matt noman
matt noman 2020 年 2 月 25 日
I don't know if I should write a user defined function or write the code directly into my script file
Aquatris
Aquatris 2020 年 2 月 25 日
編集済み: Aquatris 2020 年 2 月 25 日
Both would work fine. script would be easier IMO. You can also find some example functions in the fileexchange

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

回答 (0 件)

質問済み:

2020 年 2 月 25 日

編集済み:

2020 年 2 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by