Re: symbolic math toolbox error
- From: ellieandrogerxyzzy@xxxxxxxxxxxxxxxxxxxxxx (Roger Stafford)
- Date: Fri, 30 Jun 2006 20:32:36 GMT
In article <ef3ac40.-1@xxxxxxxxxxxxxxxxxxxxxxx>, jthu
<jrcole45@xxxxxxxxxxx> wrote:
Hello,-----------------------------------
I run this code in matlab
solve('cos(x) + sin(2*x) + tan(x)');
eval(S)
??? Error using ==> atan
Incorrect number of inputs.
Does any one know the cause of this error and how to fix it
thanks
You can probably get a better insight into your problem if you do a
little algebraic manipulation with your expression first. You are seeking
the zeros of 'cos(x)+sin(2*x)+tan(x)', so write it as:
cos(x)+sin(2*x)+tan(x) = cos(x)+2*sin(x)*cos(x)+sin(x)/cos(x) =
(cos(x)^2*(1+2*sin(x))+sin(x))/cos(x) =
((1-sin(x)^2)*(1+2*sin(x))+sin(x))/cos(x) =
(1+3*sin(x)-sin(x)^2-2*sin(x)^3)/cos(x)
So, you are trying to find the roots of the cubic polynomial:
1+3*u-u^2-2*u^3=0
where u = sin(x). You can use the 'roots' function to determine that it
has three real roots but only one of them is in range for the sine
function, namely u = -0.32103681624075. That means the two arcsines of u,
x1 = 3.46841670383273 and x2 = 5.95636125693665 are solutions and these
repeat periodically for every interval of length 2*pi - that is to say,
there are infinitely many possible solutions.
(Remove "xyzzy" and ".invalid" to send me email.)
Roger Stafford
.
- References:
- symbolic math toolbox error
- From: jthu
- symbolic math toolbox error
- Prev by Date: Re: How to call DLL generated in Matlab from Java
- Next by Date: Re: Neural network probelm please help
- Previous by thread: Re: symbolic math toolbox error
- Next by thread: simple strrep question
- Index(es):
Relevant Pages
|