Solving trigonometric equations in MATLAB
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Kubilay AKPINAR
am 24 Mär. 2020
Kommentiert: Kubilay AKPINAR
am 26 Mär. 2020
Hi there,
I am trying to solve these two equations;
r1.cos(x1)=r2+r3.cos(x2)+r4.cos(x3)
r1.sin(x1)=r5+r3.sin(x2)+r4.sin(x3)
r1,r2,r3,r4,r5 and x1 are known, x2 and x3 are the unknowns. I need to obtain x2 and x3 values according to changing x1 value (between 100 and 126 degree).
I am a begginner for MATLAB, could you please help me out?
Thanks in advance.
0 Kommentare
Akzeptierte Antwort
Birdman
am 24 Mär. 2020
Try the following code. It should help you:
r1=1;r2=2;r3=3;r4=4;r5=5;%random values
x1=100:1:126;
syms x2 x3
for i=1:numel(x1)
eq1=r1*cos(x1(i))==r2+r3*cos(x2)+r4*cos(x3);
eq2=r1*sin(x1(i))==r5+r3*sin(x2)+r4*sin(x3);
sol(i)=vpasolve([eq1 eq2],[x2 x3]);
end
The solutions are stored in sol variable. You can reach them by typing
sol(1).x2
sol(1).x3
sol(2).x2
sol(2).x3
.
.
and so on.
12 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!