陰関数を一度に解く方法
Show older comments
陰関数をfor/endを使わずに、配列で一度に解く為に、つぎのコードを書きました。
しかし、x_values=[3,4,5]に対して、yが[0,0,0]になっており、算出できていません。
間違っているところのご教示をよろしくお願いします。
% 陰関数の定義
f = @(xy) xy(1)^2 + xy(2)^2 - 25;
% xの値をベクトルで指定
x_values = [3, 4, 5];
% 初期推定値をベクトル化
initialGuess = zeros(length(x_values), 2);
initialGuess(:, 1) = x_values;
% fsolveを使用して方程式を解く
options = optimoptions('fsolve', 'Algorithm', 'levenberg-marquardt');
solutions = fsolve(f, initialGuess, options);
% 結果の表示
disp('各xに対する算出されたyの値:');
% disp(solutions(:, 2));
disp(solutions);
-----------------------
出力結果は次の通りです。
方程式は初期点で解かれました。
初期点における関数値のベクトルがゼロに近く
(関数の許容誤差値による測定)、
問題が正則として現れる (勾配による測定) ため、fsolve は完了しました。
<停止条件の詳細>
各xに対する算出されたyの値:
3 0
4 0
5 0
4 Comments
Dyuman Joshi
on 22 Dec 2023
What is the issue?
Do you not get the expected answer? If so, then please provide the values for the expected answer.
What is the objective here?
高木 範明
on 25 Dec 2023
高木 範明
on 25 Dec 2023
高木 範明
on 25 Dec 2023
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!