Code to solve integral with cosine and theta

6 Ansichten (letzte 30 Tage)
Rachel Bowlin
Rachel Bowlin am 16 Jun. 2021
Kommentiert: Rachel Bowlin am 16 Jun. 2021
How do I solve the following equation in Matlab?
∫(cos^2(θ))dθ with pi/2 as the max and 0 as the min.

Akzeptierte Antwort

Chunru
Chunru am 16 Jun. 2021
  • 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

Weitere Antworten (0)

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by