the use of fplot function

2 Ansichten (letzte 30 Tage)
metin yilmaz
metin yilmaz am 9 Nov. 2020
Beantwortet: Ameer Hamza am 9 Nov. 2020
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.

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by