Parametric radius of a circle
이전 댓글 표시
Hey everyone!
Ive been trying to solve "the envelope problem" i uploaded a few days ago and ive made huge progress. However im now stuck on some silly little thing. I need to find the parametric equation for circles radius (later many circles will be drawn with that).
My code so far is :
syms a b p x y L
F = [p/2,0];
xpara = [x sqrt(2*p*x)];
eqn1 = a*F(1,1)+b == 0;
eqn2 = a*x+b == xpara(1,2);
eqns = [eqn1 eqn2];
%L - lambda.
eqns = [a*F(1,1)+b == 0, subs(a*x+b,x,L) == subs(xpara(1,2),x,L)];
S=solve(eqns,[a b],'ReturnConditions',true);
S.a;
S.b;
sirge =simplify(S.a*x+S.b);
loikepunktx = solve(sirge==-xpara(1,2),x,'ReturnConditions',true);
%sirge is a line equation
loikepunktx.x=loikepunktx.x(2,1);
loikepunktx.x;
sirge1 = simplify(S.a * loikepunktx.x + S.b);
sirge1;
LP = [loikepunktx.x, sirge1];
%Center = KP
KP = subs(simplify((xpara + LP)/2),x,L);
%ok so far
xpara;
KP;
In wolframalpha the solution would be
pR = Simplify[(xpara - KP) . (xpara - KP)] /. x -> \[Lambda]
and it gives the answer :

In MatLab however, im always getting a dot (i.e (x,y)) not the formula. Matlab doesnt simplify it like wolfram but the answer should be similar/ simplifiable to that form.
Probably going to be asking a few more questions while trying to progress but i am close to the end :)
Edit: i just did it the easy way:
R = subs(sqrt((xpara(1,1)-KP(1,1))^2+(xpara(1,2)-KP(1,2))^2),x,L)
But it doesnt give the same answers as in wolfram. The wolframalpha answer is squared of what matlab gives me. I dont know whether my WA has a mistake in it or my matlab code.
댓글 수: 3
darova
2021년 5월 27일
MATLAB has weak symbolic toolbox. WHat about numerical approach?
Stefan Juhanson
2021년 5월 28일
Stefan Juhanson
2021년 5월 28일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
