Effacer les filtres
Effacer les filtres

INVERT first three rows of results

1 vue (au cours des 30 derniers jours)
pablolama
pablolama le 4 Fév 2019
Commenté : madhan ravi le 4 Fév 2019
I obtain these results... I want to invert first three rows of first column with first three rows of second columns.
So to have first column all positive and second all negative.
What can i do?
syms beta gamma
OA=1.42;
AB=4.3;
BO=3.33;
OO=6;
alfa=linspace(19.7, -103, 14);
% preallocate solution arrays
result_beta = nan(numel(alfa),2);
result_gamma = nan(numel(alfa),2);
% solve and save the results
for k = 1:numel(alfa)
[res_beta, res_gamma]=solve([OA*cosd(alfa(k))+AB*cosd(beta)+BO*cosd(gamma)-OO==0,...
OA*sind(alfa(k))+AB*sind(beta)+BO*sind(gamma)==0],beta,gamma);
result_beta(k,:)=double(res_beta);
result_gamma(k,:)=double(res_gamma);
disp (result_gamma)
end
results:
56.3136 -68.0355
60.0422 -66.3337
63.3157 -63.8261
-60.6513 65.9511
-56.9882 67.8010
-53.0279 68.7742
-48.9467 68.8414
-44.8871 68.0280
-40.9515 66.3985
-37.2048 64.0403
-33.6824 61.0509
-30.3996 57.5285
-27.3598 53.5685
-24.5623 49.2618
  1 commentaire
madhan ravi
madhan ravi le 4 Fév 2019
Give an example of the desired output.

Connectez-vous pour commenter.

Réponse acceptée

madhan ravi
madhan ravi le 4 Fév 2019
Alternatively:
results(1:3,[1 2])=results(1:3,[2 1])
  5 commentaires
pablolama
pablolama le 4 Fév 2019
i've posted
syms beta gamma
OA=1.42;
AB=4.3;
BO=3.33;
OO=6;
alfa=linspace(19.7, -103, 14);
% preallocate solution arrays
result_beta = nan(numel(alfa),2);
result_gamma = nan(numel(alfa),2);
% solve and save the results
for k = 1:numel(alfa)
[res_beta, res_gamma]=solve([OA*cosd(alfa(k))+AB*cosd(beta)+BO*cosd(gamma)-OO==0,...
OA*sind(alfa(k))+AB*sind(beta)+BO*sind(gamma)==0],beta,gamma);
result_beta(k,:)=double(res_beta);
result_gamma(k,:)=double(res_gamma);
result_beta(1:3,[1 2])=result_beta(1:3,[2 1])
result_gamma(1:3,[1 2])=result_gamma(1:3,[2 1])
end
madhan ravi
madhan ravi le 4 Fév 2019
I said after the loop not inside the loop.

Connectez-vous pour commenter.

Plus de réponses (1)

madhan ravi
madhan ravi le 4 Fév 2019
results(1:3,:)=fliplr(results(1:3,:))

Catégories

En savoir plus sur Mathematics dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by