Filter löschen
Filter löschen

How do you find radius from input circle?

2 Ansichten (letzte 30 Tage)
abdulsamed kaymakci
abdulsamed kaymakci am 5 Dez. 2022
Bearbeitet: Matt J am 5 Dez. 2022
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) ;

Akzeptierte Antwort

Matt J
Matt J am 5 Dez. 2022
Bearbeitet: Matt J am 5 Dez. 2022
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

Weitere Antworten (0)

Kategorien

Mehr zu Mathematics and Optimization finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by