what is better matlab function or symfun

1 Ansicht (letzte 30 Tage)
Prit Patel
Prit Patel am 18 Feb. 2017
Beantwortet: Star Strider am 18 Feb. 2017
in drawing a f(x,y)=0 which would be better...
syms f(x,y)
f=x^2+y^2
fimplicit(f)
or
f=@(x,y) x^2+y^2
fimplicit(f)

Antworten (1)

Star Strider
Star Strider am 18 Feb. 2017
Neither plot works with your code. Try fcontour instead.
Otherwise, you have to vectorise your anonymous function for it to work without error:
f=@(x,y) x.^2+y.^2
The symfun version works without modification. If you want to use it as an anonymous function without having to vectorise it yourself, use the matlabFunction function:
syms f(x,y)
f=x^2+y^2-1
figure(1)
fimplicit(f, [-10 10],'bp')
f=matlabFunction(f)
figure(2)
fimplicit(f)
I added the ‘-1’ so it will actually plot something.

Kategorien

Mehr zu Formula Manipulation and Simplification 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