Code to solve integral with cosine and theta

6 ビュー (過去 30 日間)
Rachel Bowlin
Rachel Bowlin 2021 年 6 月 16 日
コメント済み: Rachel Bowlin 2021 年 6 月 16 日
How do I solve the following equation in Matlab?
∫(cos^2(θ))dθ with pi/2 as the max and 0 as the min.

採用された回答

Chunru
Chunru 2021 年 6 月 16 日
  • integrate it manually
  • integrate it symbolically
syms x
f(x) = cos(x).^2
f(x) = 
int(f(x), 0, pi/2)
ans = 
  • integrate it numerically
x = linspace(0, pi/2, 101);
trapz(x, cos(x).^2)
ans = 0.7854

その他の回答 (0 件)

カテゴリ

Help Center および 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