How to use fimplicit with a symbolic function

2 vues (au cours des 30 derniers jours)
Kyle Donk
Kyle Donk le 10 Fév 2020
Modifié(e) : Matt J le 10 Fév 2020
I have a symbolic function r and am trying to plot it using fimplicit but I keep on getting an error in Matlab. I have tried switching up the symbolic r function, but it isn't working no matter what I try. Any suggestions?
This is a school assignment, so no complete answers.
syms x y R
r=(((x-2).^2)+((y-4).^2)==R.^2);
z=(x/2)+1;
[xc,yc]=solve(((x-2).^2)+(y-4).^2==R^2, (x/2)+1==y)
%(b)
subs(r,R,2)
hold on
fimplicit(((x-2).^2)+((y-4).^2)-R.^2)
fimplicit(z)
hold off

Réponses (1)

Matt J
Matt J le 10 Fév 2020
Modifié(e) : Matt J le 10 Fév 2020
Using matlabFunction, you can derive a non-symbolic version of your circle equation expression from the symbolic version,
>> circ=(((x-2).^2)+((y-4).^2)-R.^2)
circ =
(x - 2)^2 + (y - 4)^2 - R^2
>> circ_nonsym=matlabFunction(subs(circ,R,2))
circ_nonsym =
function_handle with value:
@(x,y)(x-2.0).^2+(y-4.0).^2-4.0
The latter can be used with fimplicit
>> fimplicit(circ_nonsym); shg

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by