4 different wrong eduations instead of one right after using solve
Show older comments
>> syms g h q sx sy v;
>> sy = (-g/2) * ( sx/(cos(q)*v) )^2 + v * sin(q) * ( sx/(cos(q)*v) )^2 + h;
>> sx=solve(sy,sx)
sx =
(2^(1/2)*v*cos(q)*(g*h - 2*h*v*sin(q))^(1/2))/(g - 2*v*sin(q))
-(2^(1/2)*v*cos(q)*(g*h - 2*h*v*sin(q))^(1/2))/(g - 2*v*sin(q))
>> sx = ( 2^(1/2) * v * cos(q) * (g * h - 2*h*v*sin(q) )^(1/2) ) / (g - 2*v*sin(q));
>> sx = diff(sx,q);
>> q=solve(sx,q);
>> q
q = asin((g + (g^2 - 4*v^2)^(1/2))/(2*v))
pi - asin((g - (g^2 - 4*v^2)^(1/2))/(2*v))
asin((g - (g^2 - 4*v^2)^(1/2))/(2*v))
pi - asin((g + (g^2 - 4*v^2)^(1/2))/(2*v))
The right equation is:
q = arcsin (v/(2*v^2+2*h*g))
Is there a way in matlab to get this equation?
4 Comments
Andrew Newell
on 28 Dec 2011
Please format your equations: http://www.mathworks.com/matlabcentral/answers/7885-tutorial-how-to-format-your-question.
Sascha
on 28 Dec 2011
Andrew Newell
on 29 Dec 2011
Your answer is not dimensionally correct. The argument to arcsin must be dimensionless, but it has units (1/velocity).
Walter Roberson
on 29 Dec 2011
Maple solves to
arctan((g + (g^2 - 4*v^2)^(1/2))/(2*v), (8*v^2-2*g^2-2*g*(g^2-4*v^2)^(1/2))^(1/2)/v)
instead of
arcsin((g + (g^2 - 4*v^2)^(1/2))/(2*v))
and the arcsin() equivalent to Maple's solution is notably different.
Accepted Answer
More Answers (2)
Andrew Newell
on 28 Dec 2011
I'm going to weed out some irrelevant material from your question and format it using the methods in How to format your question:
syms g h q sx v;
sx = ( 2^(1/2) * v * cos(q) * (g * h - 2*h*v*sin(q) )^(1/2) ) / (g - 2*v*sin(q));
dsx = diff(sx,q);
qsol=solve(dsx,q);
I get an answer, but it is much more complicated than arcsin (v/(2*v^2+2*h*g)). Moreover, if I try
simple(subs(dsx,q,asin (v/(2*v^2+2*h*g))))
which should be zero if your solution is correct, I do not get zero. Are you sure that your answer is correct?
3 Comments
Walter Roberson
on 28 Dec 2011
In Maple I get answers in terms of arctan() not arcsin(), and converting to arcsin() gives very long expressions that are not at all the same as v/(2*v^2+2*h*g) .
I do not find any significant simplification. I do find a rewrite in terms of ln of a complex number, but that is really just hiding the arctan:
-I*ln((1/2)*((8*v^2-2*g^2-2*g*(g^2-4*v^2)^(1/2))^(1/2)+I*g+I*(g^2-4*v^2)^(1/2))/v)
where "I" represents sqrt(-1)
Sascha
on 28 Dec 2011
Walter Roberson
on 28 Dec 2011
When I looked through that, I saw someone proposed using arcsin() the correction was to use arctan()
Categories
Find more on Special Values in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!