my problem is about @.

조회 수: 4 (최근 30일)
Sevval Zengin
Sevval Zengin 2022년 2월 3일
댓글: Sevval Zengin 2022년 2월 3일
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일
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
Sevval Zengin
Sevval Zengin 2022년 2월 3일
Thank you so much

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

추가 답변 (1개)

Arif Hoq
Arif Hoq 2022년 2월 3일
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

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

카테고리

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

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by