the use of fplot function

2 次查看(过去 30 天)
Would you please help me plot the function x^2 between [-2,2]?
This does not work, and would you please explain why that does not work? I think that fplot does not accept x^2 but why?
>> fplot(@(x^2)x, [-1,1]
fplot(@(x^2)x, [-1,1]
Error: Unexpected MATLAB operator.
Thank you.

采纳的回答

Ameer Hamza
Ameer Hamza 2020-11-9
Your syntax is wrong
fplot(@(x) x.^2, [-1,1])

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by