陰関数を一度に解く方法
显示 更早的评论
陰関数を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 个评论
Dyuman Joshi
2023-12-22
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?
高木 範明
2023-12-25
高木 範明
2023-12-25
高木 範明
2023-12-25
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!