2つの関数の積はどの​ようにして計算したら​いいでしょうか

8 views (last 30 days)
mushi77
mushi77 on 29 Apr 2021
Answered: Hernia Baby on 29 Apr 2021
fx=sinx/xを0,Infで積分する計算を実行する際に、関数を変えて計算できるようにfx1=sinx, fx2=xとしてfx=fx1/fx2という計算式を間に入れたいです。
func1=@(x) sin(x);
func2=@(x) x;
と定義した関数を
func=func1 * func2
としてもエラーとなってしまうのですが、関数の積はどのように定義すればいいでしょうか。

Accepted Answer

Hernia Baby
Hernia Baby on 29 Apr 2021
シンボリック値で計算してはいかがでしょうか?
syms x;
func1 = x;
func2 = sin(x);
func = func2/func1;
% 数値を代入
y = subs(func,[0.1:0.1:1]);
% シンボリック値を数値へ
double(y)'
ans =
0.9983
0.9933
0.9851
0.9735
0.9589
0.9411
0.9203
0.8967
0.8704
0.8415
------------------------------------
本計算はSymbolic Math Toolboxが必要です

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!