逆関数が見つかりません

15 vues (au cours des 30 derniers jours)
Fumiaki Kishino
Fumiaki Kishino le 26 Juil 2022
Commenté : Naoya le 3 Avr 2025
f(x) = x - cos(x)の逆関数を計算しようとしています。
逆関数自体は存在しますが、finverseでは計算できないようです。
最終的な目的は、あるxに対してg(x)の値を得ることなので、
gが式として表されなくても構わないのですが、どのようにしたら良いでしょうか。
syms x
f(x) = x - cos(x);
g = finverse(f,x);
Warning: Unable to find functional inverse.
g
g(x) = Empty sym: 0-by-1
  2 commentaires
Fumiaki Kishino
Fumiaki Kishino le 28 Juil 2022
追記:
暫定的に、fminsearchで処理する方法を試しています。
より簡便な方法や、別の方法をご存知の方がおられましたら、ご教示ください。
function y = func1(x)
y = x - cos(x);
end
function z = inv_func1(y)
cost_function = @(x) (func1(x) - y)^2;
z = fminsearch(cost_function,0);
end
Naoya
Naoya le 3 Avr 2025
今回の関数f(x) の逆関数g(x) を数式レベルで求めるのは難しいようです。
ご提示の fminsearchによる算出の他、以下のように vpasolveで求める方法もあります。
clear all, close all
% 関数 f(x) の定義
syms x
f(x) = x - cos(x);
% f(x) の逆関数 g(x) の定義
g = @(X) double(vpasolve(f==X));
% x = 1~10 において g(x)の出力を求める
xi = 1:0.1:10;
for n = 1:length(xi)
y(n) = g(xi(n));
end
% 関数 f(x), g(x) を確認
fplot(f,[1,10])
hold on
plot(xi, y)
plot(1:10)
legend({'f(x)','g(x)','y=x'})

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur 数学 dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!