Code to solve integral with cosine and theta

조회 수: 5 (최근 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 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