How do I solve this integral in matlab?

2 views (last 30 days)
  1 Comment
Sam Chak
Sam Chak on 6 Mar 2025
Hi @Aditya Zade, if you wish to call a specific user for help, you can use this special character "@".
You can also type out the integrand function in MATLAB by clicking the indentation icon .
For example
% declare symbols
syms t
% assign a value
w_g = 120*pi;
% create a function
func = - sin(w_g*t - pi/6)
func = 

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 6 Mar 2025
% declare symbols
syms t
Pi = sym(pi);
% assign a value
w_g = 2*Pi*60;
% create a function
func = - sin(w_g*t - Pi/6) .* sin(w_g*t) / sin(w_g * t - 2*Pi/3)
func = 
Integration = simplify(3*w_g/Pi * int(func, t, 0, 3*w_g, hold=true))
Integration = 
F = matlabFunction(Integration);
format long g
INT = F()
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 1.9e+04. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
INT =
-21492.6584717154
  7 Comments
Aditya Zade
Aditya Zade on 6 Mar 2025
This is what I am getting: 1/4 - (3*3^(1/2))/(8*pi)
Sam Chak
Sam Chak on 6 Mar 2025
If you attempt to solve a mathematical equation or an integral problem using functions from the Symbolic Math Toolbox, the answers will be returned as symbolic expressions.
format long
Integration = 1/4 - (3*3^(1/2))/(8*pi)
Integration =
0.043251664216828

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!