Integrating sin(2x) in MATLAB

Introduction:
I'm new to MATLAB and trying to learn how to integrate expressions.
Situation:
The expression to integrate is.....
sin(2x)
I'm entering the following code......
syms x
int(sin(2*x))
The answer MATLAB is displaying is.....
ans =
sin(x)^2
The answer I'm looking for is....... (-1/2)*cos(2x)+c

 採用された回答

Andrei Bobrov
Andrei Bobrov 2013 年 7 月 9 日

0 投票

syms x
out = feval(symengine,'combine',int(sin(2*x)),'sincos')

その他の回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 7 月 9 日

2 投票

(-1/2)*cos(2x)=(-1/2)*(cos^2(x)-sin^2(x))
=(-1/2)*(1-sin^2(x)-sin^2(x))
=(-1/2)+sin^2(x)
=sin^2(x)+c
The result found by Matlab and yours are the same

1 件のコメント

Jan
Jan 2013 年 7 月 9 日
@Shane Yost: Interesting, isn't it? Matlab replied the correct result, but you've expected another correct result.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeSymbolic Math Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by