How do you find radius from input circle?

4 ビュー (過去 30 日間)
abdulsamed kaymakci
abdulsamed kaymakci 2022 年 12 月 5 日
編集済み: Matt J 2022 年 12 月 5 日
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 Center および File ExchangeNumber Theory についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by