Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
How can I solve an equation using constants defined outside the solve command?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi, I have the following code:
solve('(.5*Tp(i)+ .5*T1)/(Tp(i)/(2*pi)) = x - e(i)*sin(x)' , '-pi/2 < x < pi/2');
where Tp, and e are taken from arrays. I get the following error:
Warning: Could not extract individual solutions. Returning a MuPAD set object. > In solve>assignOutputs at 104 In solve at 87.
When I plug in manually the values for Tp, and e, I get an answer, so the problem seems to be the face that these constants are defined outside the prompt command. How can I fix this? Note that I have an old version of matlab, so I can't use some 2014a commands. Thanks for you help!
댓글 수: 0
답변 (1개)
Walter Roberson
2014년 4월 8일
syms x
solve( (.5*Tp(i)+ .5*T1)/(Tp(i)/(2*pi)) = x - e(i)*sin(x) , '-pi/2 < x < pi/2');
If that gives you trouble then
syms x
solve((.5*Tp(i)+ .5*T1)/(Tp(i)/(2*pi)) - (x - e(i)*sin(x)) , '-pi/2 < x < pi/2');
댓글 수: 2
Walter Roberson
2014년 4월 8일
When you call solve() from the MATLAB level, each part must be either a variable name, or a name/value pair, or a symbolic equation. Your '-pi/2 < x < pi/2' is not any of those: it is a symbolic inequality.
You could try using assumptions with assume(), or you could call into the symbolic engine's solve() function using
feval(symengine, 'solve', ......)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!