Solving a sine-cosine equation ( Warning: Explicit solution could not be found.)
1 次查看(过去 30 天)
显示 更早的评论
Hi,
I'm trying to solve a symbolic equation (the more solution I get the better is), this is my code:
clear all; close all;
syms x n a;
eq = '(n*a/2 * sin(n*a*x) * sin(a*x/2)^2 - a/2 * sin(a*x) * sin(n*a*x/2)^2) / sin(a*x/2)^4 = 0';
[S]=solve(eq,x)
and I get this message:
Warning: Explicit solution could not be found. > In solve at 83
S =
[ empty sym ]
The function eq has infinite zeros, so what's wrong in my code? Is it possible to get some solutions, let's say in the range -5<x<+5?
Any help is appreciated.
Gianluca
1 个评论
Walter Roberson
2011-7-27
Do you need symbolic roots? If numeric roots are acceptable then there may be mechanisms to find all the roots within a given range.
回答(4 个)
Giovanni
2011-7-27
Hi Gianluca, I don't know if it's possible to limit the solutions to an interval using symbolic algebra. You might want to try solving it numerically? Also, assuming n is an integer:
equation = simple( (n*a/2 * sin(n*a*x) * sin(a*x/2)^2 - a/2 * sin(a*x) * sin(n*a*x/2)^2) / sin(a*x/2)^4 )
equationN = simple( subs(equation,n,3) );
solve(equationN,x)
ans =
0
(2*pi)/(3*a)
-(2*pi)/(3*a)
and so on if you replace n you'll get multiple solutions. It's just a work-around but maybe it'll help?
3 个评论
Giovanni
2011-7-27
That's what solve outputs... I didn't look at the details of your equation so I am not sure how to answer that, but I would expect the solutions to have some periodicity, right?
Walter Roberson
2011-7-27
2*RootOf(tan(Z)*n-tan(n*Z),Z)/a
is the general form.
For n=3, the general solutions are
(set of 4*Pi*Z/a) union set of (2*(Pi+2*Pi*Z)/a)
where Z ranges over all of the integers.
The solutions for higher n are more extensive -- e.g., 10 sets for n=6 .
0 个评论
Stefan Wehmeier
2011-7-28
There is no closed-form symbolic solution for general n, and for given n nobody can say which solutions are between -5 and 5 without knowing a. If you insert integer values for n, the solution will be found, but the complete (infinite) solution can only be represented in the symbolic engine, not on the matlab level, so you may want to proceed with
evalin(symengine, 'solve(your_equation, x)')
or use feval.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Assumptions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!