syms x
f=@x x.^2
quad(f,0,2)
System give error that 'Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.'
.....................................................................................................................................................................................................................................
PLEASE HELP ME

댓글 수: 2

Stephen23
Stephen23 2022년 2월 3일
Note that syms does nothing here. Get rid of it.
Sevval Zengin
Sevval Zengin 2022년 2월 3일
Thank you so much Stephen for your answer.

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

 채택된 답변

Stephen23
Stephen23 2022년 2월 3일
편집: Stephen23 2022년 2월 3일

1 개 추천

f = @(x) x.^2;
% ^ ^ you forgot these parentheses
q = quad(f,1,2)
q = 2.3333
How to define anonymous functions is explained here:

추가 답변 (1개)

Arif Hoq
Arif Hoq 2022년 2월 3일

1 개 추천

try it:
syms x
f=@(x) x.^2
f = function_handle with value:
@(x)x.^2
quad(f,0,2)
ans = 2.6667

댓글 수: 2

Stephen23
Stephen23 2022년 2월 3일
Note that syms does nothing here.
Sevval Zengin
Sevval Zengin 2022년 2월 3일
thank youuu so much

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

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

제품

릴리스

R2021b

질문:

2022년 2월 3일

댓글:

2022년 2월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by