Afficher commentaires plus anciens
f(x) = x - cos(x)の逆関数を計算しようとしています。
逆関数自体は存在しますが、finverseでは計算できないようです。
最終的な目的は、あるxに対してg(x)の値を得ることなので、
gが式として表されなくても構わないのですが、どのようにしたら良いでしょうか。
syms x
f(x) = x - cos(x);
g = finverse(f,x);
g
2 commentaires
Fumiaki Kishino
le 28 Juil 2022
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'})
Réponses (0)
Catégories
En savoir plus sur 数学 dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!