How do I solve this integral in matlab?

조회 수: 3 (최근 30일)
Aditya Zade
Aditya Zade 2025년 3월 6일
댓글: Sam Chak 2025년 3월 6일
  댓글 수: 1
Sam Chak
Sam Chak 2025년 3월 6일
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 = 

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2025년 3월 6일
% 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
Aditya Zade
Aditya Zade 2025년 3월 6일
This is what I am getting: 1/4 - (3*3^(1/2))/(8*pi)
Sam Chak
Sam Chak 2025년 3월 6일
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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by