Code to solve integral with cosine and theta

5 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by