How to combine subs and solve correctly?

2 views (last 30 days)
Dear MATLAB-Central,
Trying to solve the intersection of a circle (param. repr. x=C+R*(1-T^2)/(1+T^2); y=D+R*(2*T)/(1+T^2)) and an ellipse ((x-E)^2/A^2 + (y-F)^2/B^2 = 1), with given but varying positions and radii in the variables a,b,c,d,e,f, I do the following:
  • syms A B C D E F R t
  • Expr = (C+R*(1-(t*t))/(1+(t*t)) - E)*(C+R*(1-(t*t))/(1+(t*t)) - E)/(A*A) + (D+R*2*t/(1+(t*t)) - F)*(D+R*2*t/(1+(t*t)) - F)/(B*B);
  • Expr = subs(Expr,{A,B,C,D,E,F,R},{a,b,c,d,e,f,r});
  • Expr = simplify(Expr);
  • solve(Expr == 1,t)
This code produces the error message: "Conversion to char from logical is not possible."
How can I solve this problem? I greatly appreciate any help suggestion.
Best regards,
Verena

Accepted Answer

Walter Roberson
Walter Roberson on 3 Oct 2012
The ability to use "==" in solve() was introduced in R2012a. If you are using an earlier version you will have to change your last line to
solve(Expr - 1, t)
  1 Comment
Verena
Verena on 3 Oct 2012
Walter,
Thank you very much for your prompt answer and this hint.
But unfortunately, the manner the derived solution is quite hard to compare: The program puts out four intersection points given as giant expressions, like 1/6/(22578481442063296/106741283587350147 + 3^(1/2)*32010144944016589^(1/2)*1280000/3953380873605561*... and much more longer. The simplify-call takes a lot time and does not reveal a better readable expression either.
I'm looking forward for an approximation of the intersection points up to the second position after decimal point. Do you know any routine which will do it?
Thank you very much for your attention,
Verena

Sign in to comment.

More Answers (0)

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!