Check for missing argument or incorrect argument data type in call to function 'integral'.
조회 수: 1 (최근 30일)
이전 댓글 표시
I have an issue with my function has an integral. I wish to integrate a function with one of my input variables defined for my function, but Matlab wants me to use syms to define the variable. I already change interagal to 'int' but it still dosent work. Is there a way I can work around this issue? Any help is appreciated and thank you for your time.
f = sqrt(2)*x^3;
a = integral(f, 0, 9);
syms theta sin
g = 4+2*(sin^2*(theta));
b = integral(g, 0, pi/2);
ans = a*b
댓글 수: 0
채택된 답변
Voss
2021년 12월 27일
syms x theta
f = sqrt(2)*x^3;
a = int(f, 0, 9)
g = 4+2*(sin(theta)^2);
b = int(g, 0, pi/2)
ans = a*b
추가 답변 (1개)
Meg Noah
2021년 12월 28일
One way is to use anonymous functions
f = @(x) sqrt(2)*x.^3;
g = @(theta) 4+2*(sin(theta).^2);
a = integral(f, 0, 9);
b = integral(g, 0, pi/2);
ans = a*b
참고 항목
카테고리
Help Center 및 File Exchange에서 Calculus에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!