필터 지우기
필터 지우기

Issues with solve. Cannot solve symbolically. Returning a numeric approximation instead.

조회 수: 1 (최근 30일)
Hi there,
I'm trying to use 'solve' for 'a' by using 'syms' but I think it always retrieve an answer even if it didn't solve. I'm solving for a vector that is varying gradually so the 'aSolved' variable shall vary gradually but instead I have some points lying outside the range. I have some values in excel and I'm comparing them and for some values the results is exactly the same but in some other cases they are not. Here is where I called the 'solve:
for i=1:q
syms a positive
Ab=(a(i)g(i)).*(((m(i)*(1-cos(a)))-m(i))*(a) + m(i)*sin(a)) + g(i)*pi.*((m(i)*(1-cos(a)))-m(i))==0;
solve_a=solve(eqn1,a);
aSolved(i)=solve_a;
end
If anyone have any idea about what might be happening, I'll appreciate very much if you can give me some guidance on this.
Best, Martha

답변 (1개)

Torsten
Torsten 2017년 8월 4일
As written, your equation reduces to
a(i)*(-cos(asol)*asol + sin(asol))-cos(asol)*pi==0
where I renamed the solution variable because of the equally named numeric array "a".
I suspect that the above equation might have several roots.
Best wishes
Torsten.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by