Parametric radius of a circle
Show older comments
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 Comments
darova
on 27 May 2021
MATLAB has weak symbolic toolbox. WHat about numerical approach?
Stefan Juhanson
on 28 May 2021
Stefan Juhanson
on 28 May 2021
Answers (0)
Categories
Find more on MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!