how to calculate angle in loop?
Mostra commenti meno recenti
hi please help me, how to calculate the angle using loop
%Calculate angle
%Loop1
if azA,azB>90;
azA1=180-azA;
azB1=180-azB;
elseif azA,azB<90;
azA1=azA-0;
azB1=azB-0;
end
%Second LOOP
if azA,azB<270;
azA1=azA-180;
azB1=azB-180;
elseif azA,azB>270;
azA1=360azA;
azB1=360-azB;
end
2 Commenti
Dyuman Joshi
il 16 Mag 2021
Your syntax usage is incorrect in the if and elseif statements. And this aren't loops, they are conditional statements. As for anything else, your question is unclear? What do you want to do exactly?
nur aida azlin abdul aziz
il 16 Mag 2021
Risposte (2)
Sulaymon Eshkabilov
il 16 Mag 2021
If your assignment requires loop only, then here is a brief solution that can be extended a bit with some comments:
azA = input('Angle for azA: ');
azB = input('Angle for azB: ');
if azA>90 && azB>90
azA1=180-azA;
azB1=180-azB;
elseif azA<90 && azB<90
azA1=azA-0;
azB1=azB-0;
end
%% Second LOOP
if azA<270 && azB<270
azA1=azA-180;
azB1=azB-180;
elseif azA>270 &&azB>270
azA1=360-azA;
azB1=360-azB;
end
1 Commento
nur aida azlin abdul aziz
il 16 Mag 2021
nur aida azlin abdul aziz
il 16 Mag 2021
2 Commenti
Walter Roberson
il 16 Mag 2021
That code does not have any loops.
Sulaymon Eshkabilov
il 16 Mag 2021
Note that if you have a series of values of azimuth, then you would need to build [for .. end] loop as well.
Categorie
Scopri di più su Loops and Conditional Statements in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!