How do you find radius from input circle?

1 次查看(过去 30 天)
I wrote a code like given below to get a circle equation from user and i need to find radius to make some calculation.(exp :2*x^2 + 2*y^2 = 8)
circle = input('Enter for circular path: ','s') ;
C = str2sym(circle) ;

采纳的回答

Matt J
Matt J 2022-12-5
编辑:Matt J 2022-12-5
syms x y real
syms r real positive
c=2*(x-3)^2 + 2*(y+7)^2 == 8;
c0=str2sym(extractBefore(char(c),'=='));
sol0=solve(c0,[x,y]) %center of circle
sol0 = struct with fields:
x: 3 y: -7
c=subs(c,[x,y],[r+sol0.x,sol0.y]);
radius=double( solve(c,r) )
radius = 2

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Number Theory 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by