Find out θ in the cos(wt+θ) = A
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello and thank you for reading my question,
Following problem: I got 2 sinusidal waves. One wave(f1,red) starts at point t1 and ends at point t2. The other(f2,blue) starts at point t2 and ends at point t3. I am trying to find out based on the difference in the amplitude at point t2 the θ-angle between those functions in order to get function f3(green), which will be a reconstruction of function f2. Both functions are normalized, with Amax = [1,-1] and both f1 and f2 are functions of the type cos(wt+θ); where for f1, θ=0 and for f2 θ is searched.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/822480/image.png)
Now I tried to solve this with following code:
syms theta
A = f2(1);
tau = t12(end)-t12(1); % center red function so that t1 is 0
w = 2*pi*rpm;
eqn2 = cos(w*tau + theta) == A;
eqn2 = solve(eqn2,theta);
Which makes sense, because if I do this in my calculator I get many answers and the one near 0 is the right one. Thats why I could build the green function. But Matlab seems to give me only 2 answers for theta and I don't get why... Is there a way to solve this problem? Or am I doing something wrong?
Thank you for your help!
0 Kommentare
Antworten (2)
MULI
am 29 Feb. 2024
Hi Issac,
I understand that when the equation is solved using "solve" function it is providing two solutions.
Since cosine function has period 2*pi there are infinitely many solutions to the equation. MATLAB typically returns the principal values that are in range [-pi, pi] which satisfies the equation. Due to this reason, it provides two values.
Hope this answer clarifies your query!
0 Kommentare
Walter Roberson
am 29 Feb. 2024
eqn2 = solve(eqn2, theta, 'returnconditions', true);
will probably return a solution that is parameterized in terms of an extra variable, with the conditions returned describing the relationship that has to be satisfied for the extra variable.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Assumptions finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!