フィルターのクリア

Programming a function for use in another script

3 ビュー (過去 30 日間)
Ollie
Ollie 2015 年 8 月 16 日
編集済み: Matt J 2015 年 8 月 16 日
I've programmed a script to run multivariate Newton's method on a non-linear function. It's usage is:
function [X]=mynewtonA(fname,x0,maxIts,tol)
fname represents the function I want to program.
I'm trying to program the following function for use in this existing function:
I'm not sure how to do this. So basically, what should be code be to produce this function in a new file that I can then call upon in my existing script?

採用された回答

Matt J
Matt J 2015 年 8 月 16 日
編集済み: Matt J 2015 年 8 月 16 日
You could write an mfile for this function and pass a handle to that function to mynewtonA. See Calling a Function Using it's Handle.
You could also create an Anonymous Function
f=@(x) [x(1)-sin(x(2));x(1).*sqrt(abs(x(2))) ];
and pass that directly.
  1 件のコメント
Ollie
Ollie 2015 年 8 月 16 日
Thanks Matt

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

その他の回答 (0 件)

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by