필터 지우기
필터 지우기

How do you find radius from input circle?

조회 수: 2 (최근 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 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