Info
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
How can I solve an equation using constants defined outside the solve command?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Walter Roberson
il 8 Apr 2014
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 Commenti
Walter Roberson
il 8 Apr 2014
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', ......)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!