Filter löschen
Filter löschen

INVERT first three rows of results

2 Ansichten (letzte 30 Tage)
pablolama
pablolama am 4 Feb. 2019
Kommentiert: madhan ravi am 4 Feb. 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

Akzeptierte Antwort

madhan ravi
madhan ravi am 4 Feb. 2019
Alternatively:
results(1:3,[1 2])=results(1:3,[2 1])
  5 Kommentare
pablolama
pablolama am 4 Feb. 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 am 4 Feb. 2019
I said after the loop not inside the loop.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

madhan ravi
madhan ravi am 4 Feb. 2019
results(1:3,:)=fliplr(results(1:3,:))

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!

Translated by