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 Comments

Note that syms does nothing here. Get rid of it.
Thank you so much Stephen for your answer.

Sign in to comment.

 Accepted Answer

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

More Answers (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 Comments

Note that syms does nothing here.
thank youuu so much

Sign in to comment.

Categories

Find more on Mathematics in Help Center and File Exchange

Products

Release

R2021b

Community Treasure Hunt

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

Start Hunting!