How to separate a variable out of trigonomic expression

조회 수: 1 (최근 30일)
Thom Gold
Thom Gold 2019년 12월 11일
댓글: Thom Gold 2019년 12월 11일
I have two trigonomic expressions ( cos(a+b) / sin(a+b) ).
Is there a possibility to separate one of the variables so that I have terms with an isolated sin(a) or cos(a) so that I can pull these terms out of the expressions?
  댓글 수: 4
John D'Errico
John D'Errico 2019년 12월 11일
It looks like the answers we have tried to offer are all a bit off-base, given the comment.
But even so, you cannot use MATLAB to do that which is not mathematically possible. That is, you cannot write a term like sin(a+b) or cos(a+b) in a separable product form like f1(a)*f2(b). No solver applies here, because it is not possible to achieve.
I would suggest you need to reconsider the approach you wish to take.
Thom Gold
Thom Gold 2019년 12월 11일
already thought that there is no possibility.
I will try it another way.
Thank you very much for anyway trying to help :-)

댓글을 달려면 로그인하십시오.

답변 (3개)

Matt J
Matt J 2019년 12월 11일
편집: Matt J 2019년 12월 11일
These identities may help,
  댓글 수: 3
Matt J
Matt J 2019년 12월 11일
I've answered your question. Using the identities I posted, you can write instead
Fx = F*( sin(a)*cos(b) + cos(a)*sin(b) );
Fz = F*( cos(a)*cos(b) - sin(a)*sin(b) );
Matt J
Matt J 2019년 12월 11일
Thom replied:
Thank you for your answer,
I was already at this point but what I need is an expression which contains only "sin(a)" or "cos(a)" expressions so that I can pull it out of both terms.
If there is a combination of sin and cos in it I can't pull it out of the term.

댓글을 달려면 로그인하십시오.


Alex Mcaulley
Alex Mcaulley 2019년 12월 11일
It is not a Matlab question, but you can do:
cos(a+b)/sin(a+b) = 1/tg(a+b) = (1-tg(a)*tg(b))/(tg(a)+tg(b))
  댓글 수: 1
Thom Gold
Thom Gold 2019년 12월 11일
Sorry for describing the problem a bit lazy.
My Problem is a mathematical one but I hoped that there would be a solver or function in MATLAB which could help me.
I have a control path with two Inputs. The Inputs are described by U1 = Fx / (m*g) and U2 = (Fz / (m*g)) - 1 . I want to transform the system into a single input system. For this transformation I wanted to use the (given) Equations Fx = F * sin (a+b) and Fz = cos(a+b).
My Input parameter should be an "a" or an trigonomic combination of "a". So I wanted to pull it out of the expression so that I have a vector of two terms which I can multiplicate with "a" or "sin(a)" or "cos(a)" such like: [Term1 ; Term 2] * "a" or [Term1 ; Term2] * "sin(a)" or [Term1 ; Term2] * "cos(a)".
My problem is, that I can't transform it to an expression where I can pull the Input variable out of it.
For this problem I hoped that there is MATLAB function which could help.
I'm not sure but I hope this will describe my problem a bit better.
Thank you very much

댓글을 달려면 로그인하십시오.


John D'Errico
John D'Errico 2019년 12월 11일
편집: John D'Errico 2019년 12월 11일
As has been pointed out, this is not remotely a question about MATLAB, but you have gotten two answers already, so let me point out some things.
Fiirst, you don't really have two expressions, but one expression, with a numerator and a denominator. And, you need to explain what it is that you want to do with this, because such an expression does not exist in a vacuum. For example, are you hoping to be able to write it in a form like
f1(a)*f2(b)
or perhaps
f1(a) + f2(b)
by using only simple algebraic operations? If so, then the answer is no, you cannot do so. MATLAB cannot help you there.
If, perhaps you have something of the form
U = cos(a+b)/sin(a+b)
and you want to solv e for a as a function of b and U? Then you can do something, although even that has limits.
U = 1/tan(a+b) = (1 - tan(a)*tan(b))/(tan(a) + tan(b))
or...
(tan(a) + tan(b)) * U = 1 - tan(a)*tan(b)
so we can write it as
tan(a)*(U + tan(b)) = 1 - tan(b)*U
therefore,
tan(a) = (1 - tan(b)*U)/(U + tan(b))
Honestly, I don't think that is what you intended by your question.
Or, perhaps if you have
U = 1/(tan(a+ b)
then we can trivially solve for a as
a = atan(1/U) - b
Again, I don't think this is what you are looking for, based on how you phrased your question.
There might be other thigns you could do. For example, if a is known to be relatively small, then you could expand the expression
cos(a + b)/sin(a + b)
in the form of a truncated Taylor series, expanded around b. That is,
syms a b
U = cos(a + b)/sin(a+b);
taylor(U,a,'expansion',b)
ans =
cos(2*b)/sin(2*b) + (a - b)^4*((5*cos(2*b))/(24*sin(2*b)) + (cos(2*b)*(cos(2*b)^2/(3*sin(2*b)^2) + (cos(2*b)*(cos(2*b)/(3*sin(2*b)) + (cos(2*b)*(cos(2*b)^2/sin(2*b)^2 + 1/2))/sin(2*b)))/sin(2*b) + 5/24))/sin(2*b) + (cos(2*b)*(cos(2*b)^2/sin(2*b)^2 + 1/2))/(2*sin(2*b))) - (a - b)^5*((5*cos(2*b)^2)/(24*sin(2*b)^2) + (cos(2*b)*(cos(2*b)/(3*sin(2*b)) + (cos(2*b)*(cos(2*b)^2/sin(2*b)^2 + 1/2))/sin(2*b)))/(2*sin(2*b)) + (cos(2*b)*((2*cos(2*b))/(15*sin(2*b)) + (cos(2*b)*(cos(2*b)^2/(3*sin(2*b)^2) + (cos(2*b)*(cos(2*b)/(3*sin(2*b)) + (cos(2*b)*(cos(2*b)^2/sin(2*b)^2 + 1/2))/sin(2*b)))/sin(2*b) + 5/24))/sin(2*b) + (cos(2*b)*(cos(2*b)^2/sin(2*b)^2 + 1/2))/(3*sin(2*b))))/sin(2*b) + 2/15) - (a - b)^3*(cos(2*b)^2/(2*sin(2*b)^2) + (cos(2*b)*(cos(2*b)/(3*sin(2*b)) + (cos(2*b)*(cos(2*b)^2/sin(2*b)^2 + 1/2))/sin(2*b)))/sin(2*b) + 1/3) + (cos(2*b)/(2*sin(2*b)) + (cos(2*b)*(cos(2*b)^2/sin(2*b)^2 + 1/2))/sin(2*b))*(a - b)^2 - (a - b)*(cos(2*b)^2/sin(2*b)^2 + 1)
The result will be essentially a low order polynomial in a. As long as a is relatively small, we can truncate the polynomial, throwing away any high order terms in a. a might need to be very small however for the result to have any value.
taylor(U,a,'expansion',b,'order',2)
ans =
cos(2*b)/sin(2*b) - (a - b)*(cos(2*b)^2/sin(2*b)^2 + 1)
  댓글 수: 1
Thom Gold
Thom Gold 2019년 12월 11일
Sorry for describing the problem a bit lazy.
My Problem is a mathematical one but I hoped that there would be a solver or function in MATLAB which could help me.
I have a control path with two Inputs. The Inputs are described by U1 = Fx / (m*g) and U2 = (Fz / (m*g)) - 1 . I want to transform the system into a single input system. For this transformation I wanted to use the (given) Equations Fx = F * sin (a+b) and Fz = cos(a+b).
My Input parameter should be an "a" or an trigonomic combination of "a". So I wanted to pull it out of the expression so that I have a vector of two terms which I can multiplicate with "a" or "sin(a)" or "cos(a)" such like: [Term1 ; Term 2] * "a" or [Term1 ; Term2] * "sin(a)" or [Term1 ; Term2] * "cos(a)".
My problem is, that I can't transform it to an expression where I can pull the Input variable out of it.
For this problem I hoped that there is MATLAB function which could help.
I'm not sure but I hope this will describe my problem a bit better.
Thank you very much

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by