Solving matrix differential equation

14 views (last 30 days)
Yokuna
Yokuna on 24 Feb 2023
Edited: Torsten on 26 Feb 2023
I want to solve the matrix differential equation of the form,
. The initial condition for R1 is given. W1 and W2 are calculated using .
R1 = [1 1 2; 2 1 2; 1 4 1];
R2 = [1 5 3; 3 1 2; 2 6 4];
tspan = [0 10];
odefun1 = @(t,R)fun1(t,R,R1,R2);
[T,F1] = ode45(odefun1,tspan,R1);
F1 = reshape(F1.',3,3,[])
F1 =
F1(:,:,1) = 1 1 2 2 1 2 1 4 1 F1(:,:,2) = 0.9698 0.9897 2.0199 1.9697 0.9997 2.0300 0.9495 3.9995 1.0500 F1(:,:,3) = 0.9395 0.9789 2.0394 1.9391 0.9988 2.0597 0.8985 3.9980 1.0994 F1(:,:,4) = 0.9092 0.9676 2.0584 1.9083 0.9973 2.0890 0.8471 3.9955 1.1484 F1(:,:,5) = 0.8787 0.9558 2.0771 1.8771 0.9952 2.1181 0.7952 3.9919 1.1968 F1(:,:,6) = 0.7257 0.8895 2.1638 1.7176 0.9755 2.2579 0.5293 3.9592 1.4299 F1(:,:,7) = 0.5723 0.8115 2.2392 1.5526 0.9409 2.3883 0.2544 3.9016 1.6472 F1(:,:,8) = 0.4196 0.7223 2.3027 1.3835 0.8917 2.5082 -0.0275 3.8194 1.8469 F1(:,:,9) = 0.2688 0.6225 2.3538 1.2115 0.8281 2.6166 -0.3142 3.7135 2.0277 F1(:,:,10) = -0.0042 0.4107 2.4149 0.8867 0.6727 2.7860 -0.8555 3.4545 2.3099 F1(:,:,11) = -0.2594 0.1704 2.4298 0.5650 0.4732 2.9082 -1.3917 3.1220 2.5136 F1(:,:,12) = -0.4901 -0.0919 2.3982 0.2548 0.2348 2.9800 -1.9086 2.7246 2.6333 F1(:,:,13) = -0.6903 -0.3694 2.3210 -0.0357 -0.0362 2.9995 -2.3929 2.2730 2.6659 F1(:,:,14) = -0.8638 -0.6724 2.1913 -0.3143 -0.3515 2.9628 -2.8571 1.7475 2.6046 F1(:,:,15) = -0.9917 -0.9753 2.0164 -0.5537 -0.6861 2.8677 -3.2562 1.1899 2.4461 F1(:,:,16) = -1.0702 -1.2689 1.8013 -0.7468 -1.0299 2.7170 -3.5781 0.6169 2.1949 F1(:,:,17) = -1.0971 -1.5446 1.5525 -0.8881 -1.3729 2.5152 -3.8134 0.0452 1.8587 F1(:,:,18) = -1.0701 -1.8020 1.2681 -0.9752 -1.7154 2.2598 -3.9586 -0.5256 1.4330 F1(:,:,19) = -0.9880 -2.0234 0.9646 -0.9997 -2.0352 1.9645 -3.9995 -1.0586 0.9409 F1(:,:,20) = -0.8534 -2.2016 0.6518 -0.9607 -2.3220 1.6387 -3.9346 -1.5367 0.3978 F1(:,:,21) = -0.6706 -2.3312 0.3394 -0.8596 -2.5670 1.2926 -3.7661 -1.9451 -0.1790 F1(:,:,22) = -0.4335 -2.4108 0.0227 -0.6904 -2.7709 0.9195 -3.4841 -2.2849 -0.8008 F1(:,:,23) = -0.1580 -2.4294 -0.2714 -0.4623 -2.9130 0.5494 -3.1039 -2.5216 -1.4177 F1(:,:,24) = 0.1463 -2.3864 -0.5327 -0.1831 -2.9881 0.1950 -2.6385 -2.6468 -2.0083 F1(:,:,25) = 0.4687 -2.2834 -0.7521 0.1374 -2.9938 -0.1313 -2.1043 -2.6564 -2.5521 F1(:,:,26) = 0.7781 -2.1354 -0.9135 0.4660 -2.9361 -0.4021 -1.5566 -2.5602 -3.0036 F1(:,:,27) = 1.0840 -1.9422 -1.0262 0.8110 -2.8188 -0.6298 -0.9816 -2.3647 -3.3831 F1(:,:,28) = 1.3769 -1.7097 -1.0866 1.1618 -2.6455 -0.8072 -0.3971 -2.0758 -3.6787 F1(:,:,29) = 1.6480 -1.4451 -1.0931 1.5076 -2.4214 -0.9290 0.1793 -1.7024 -3.8816 F1(:,:,30) = 1.8951 -1.1485 -1.0436 1.8465 -2.1460 -0.9925 0.7441 -1.2433 -3.9874 F1(:,:,31) = 2.1023 -0.8363 -0.9386 2.1579 -1.8334 -0.9912 1.2631 -0.7223 -3.9854 F1(:,:,32) = 2.2628 -0.5187 -0.7814 2.4315 -1.4937 -0.9253 1.7192 -0.1562 -3.8754 F1(:,:,33) = 2.3714 -0.2058 -0.5772 2.6587 -1.1381 -0.7968 2.0979 0.4366 -3.6613 F1(:,:,34) = 2.4262 0.1071 -0.3191 2.8398 -0.7593 -0.5990 2.3996 1.0679 -3.3317 F1(:,:,35) = 2.4178 0.3921 -0.0257 2.9548 -0.3892 -0.3440 2.5913 1.6847 -2.9066 F1(:,:,36) = 2.3464 0.6390 0.2925 2.9994 -0.0412 -0.0406 2.6656 2.2647 -2.4010 F1(:,:,37) = 2.2148 0.8390 0.6243 2.9723 0.2724 0.3002 2.6204 2.7874 -1.8330 F1(:,:,38) = 2.0393 0.9788 0.9395 2.8817 0.5273 0.6456 2.4695 3.2122 -1.2574 F1(:,:,39) = 1.8198 1.0657 1.2459 2.7309 0.7332 1.0023 2.2181 3.5553 -0.6629 F1(:,:,40) = 1.5633 1.0970 1.5336 2.5244 0.8832 1.3588 1.8740 3.8054 -0.0686 F1(:,:,41) = 1.2780 1.0716 1.7936 2.2690 0.9729 1.7039 1.4484 3.9549 0.5065 F1(:,:,42) = 0.9664 0.9884 2.0220 1.9663 0.9995 2.0332 0.9438 3.9991 1.0554 F1(:,:,43) = 0.6448 0.8498 2.2049 1.6312 0.9591 2.3279 0.3854 3.9318 1.5465 F1(:,:,44) = 0.3241 0.6603 2.3363 1.2751 0.8530 2.5779 -0.2082 3.7550 1.9632 F1(:,:,45) = 0.0147 0.4265 2.4117 0.9097 0.6849 2.7752 -0.8172 3.4748 2.2920 F1(:,:,46) = -0.2878 0.1405 2.4283 0.5278 0.4468 2.9190 -1.4537 3.0781 2.5317 F1(:,:,47) = -0.5548 -0.1754 2.3794 0.1636 0.1551 2.9915 -2.0607 2.5918 2.6525 F1(:,:,48) = -0.7761 -0.5096 2.2665 -0.1694 -0.1797 2.9897 -2.6156 2.0338 2.6494 F1(:,:,49) = -0.9438 -0.8497 2.0942 -0.4589 -0.5451 2.9138 -3.0981 1.4249 2.5230 F1(:,:,50) = -1.0461 -1.1590 1.8871 -0.6791 -0.8990 2.7801 -3.4652 0.8351 2.3002 F1(:,:,51) = -1.0937 -1.4526 1.6411 -0.8457 -1.2560 2.5896 -3.7428 0.2399 1.9827 F1(:,:,52) = -1.0849 -1.7209 1.3639 -0.9531 -1.6048 2.3483 -3.9219 -0.3414 1.5805 F1(:,:,53) = -1.0201 -1.9556 1.0645 -0.9982 -1.9343 2.0639 -3.9970 -0.8906 1.1065 F1(:,:,54) = -0.9003 -2.1509 0.7494 -0.9793 -2.2367 1.7425 -3.9654 -1.3946 0.5709 F1(:,:,55) = -0.7296 -2.2979 0.4318 -0.8959 -2.4989 1.3971 -3.8266 -1.8315 -0.0049 F1(:,:,56) = -0.5135 -2.3917 0.1218 -0.7508 -2.7121 1.0387 -3.5847 -2.1868 -0.6021 F1(:,:,57) = -0.2589 -2.4294 -0.1705 -0.5488 -2.8697 0.6791 -3.2480 -2.4495 -1.2014 F1(:,:,58) = 0.0320 -2.4090 -0.4410 -0.2907 -2.9681 0.3225 -2.8178 -2.6135 -1.7958 F1(:,:,59) = 0.3445 -2.3294 -0.6739 0.0112 -2.9998 -0.0110 -2.3146 -2.6663 -2.3517 F1(:,:,60) = 0.6678 -2.1934 -0.8612 0.3467 -2.9634 -0.3101 -1.7555 -2.6057 -2.8502 F1(:,:,61) = 0.9911 -2.0055 -0.9967 0.7043 -2.8605 -0.5648 -1.1595 -2.4341 -3.2746 F1(:,:,62) = 1.2764 -1.7949 -1.0712 1.0391 -2.7118 -0.7509 -0.6015 -2.1864 -3.5849 F1(:,:,63) = 1.5444 -1.5525 -1.0969 1.3727 -2.5151 -0.8878 -0.0455 -1.8584 -3.8130 F1(:,:,64) = 1.7876 -1.2852 -1.0728 1.6958 -2.2756 -0.9714 0.4929 -1.4594 -3.9523 F1(:,:,65) = 1.9993 -1.0004 -0.9998 1.9993 -2.0003 -0.9995 0.9988 -1.0004 -3.9992 F1(:,:,66) = 2.1770 -0.6998 -0.8768 2.2804 -1.6899 -0.9703 1.4674 -0.4832 -3.9505 F1(:,:,67) = 2.3104 -0.3982 -0.7086 2.5239 -1.3593 -0.8832 1.8732 0.0678 -3.8054 F1(:,:,68) = 2.3953 -0.1046 -0.4999 2.7225 -1.0182 -0.7407 2.2042 0.6363 -3.5679 F1(:,:,69) = 2.4294 0.1725 -0.2569 2.8705 -0.6766 -0.5471 2.4509 1.2057 -3.2451 F1(:,:,70) = 2.4090 0.4402 0.0312 2.9678 -0.3236 -0.2914 2.6130 1.7940 -2.8190 F1(:,:,71) = 2.3307 0.6711 0.3404 2.9997 0.0068 0.0071 2.6661 2.3447 -2.3215 F1(:,:,72) = 2.1970 0.8574 0.6603 2.9649 0.3036 0.3387 2.6082 2.8393 -1.7689 F1(:,:,73) = 2.0125 0.9930 0.9805 2.8648 0.5571 0.6923 2.4414 3.2618 -1.1796 F1(:,:,74) = 1.8033 1.0692 1.2660 2.7182 0.7448 1.0266 2.1970 3.5746 -0.6223 F1(:,:,75) = 1.5621 1.0967 1.5346 2.5233 0.8834 1.3601 1.8722 3.8057 -0.0664 F1(:,:,76) = 1.2959 1.0746 1.7787 2.2856 0.9691 1.6835 1.4759 3.9484 0.4725 F1(:,:,77) = 1.0119 1.0035 1.9916 2.0117 0.9994 1.9877 1.0195 3.9990 0.9794 F1(:,:,78) = 0.7103 0.8818 2.1715 1.7011 0.9722 2.2712 0.5018 3.9537 1.4519 F1(:,:,79) = 0.4075 0.7143 2.3069 1.3697 0.8867 2.5170 -0.0505 3.8111 1.8617 F1(:,:,80) = 0.1124 0.5059 2.3936 1.0274 0.7452 2.7177 -0.6210 3.5753 2.1962 F1(:,:,81) = -0.1664 0.2627 2.4291 0.6843 0.5520 2.8677 -1.1928 3.2533 2.4461 F1(:,:,82) = -0.4346 -0.0246 2.4100 0.3312 0.2975 2.9663 -1.7813 2.8291 2.6105 F1(:,:,83) = -0.6663 -0.3332 2.3331 0.0004 -0.0000 2.9996 -2.3327 2.3333 2.6660 F1(:,:,84) = -0.8535 -0.6529 2.2007 -0.2971 -0.3308 2.9664 -2.8285 1.7821 2.6106 F1(:,:,85) = -0.9903 -0.9730 2.0173 -0.5516 -0.6837 2.8678 -3.2526 1.1938 2.4464 F1(:,:,86) = -1.0679 -1.2595 1.8085 -0.7409 -1.0188 2.7221 -3.5681 0.6354 2.2035 F1(:,:,87) = -1.0966 -1.5291 1.5674 -0.8810 -1.3532 2.5278 -3.8016 0.0780 1.8796 F1(:,:,88) = -1.0753 -1.7744 1.3010 -0.9679 -1.6776 2.2903 -3.9465 -0.4627 1.4838 F1(:,:,89) = -1.0049 -1.9883 1.0166 -0.9992 -1.9829 2.0163 -3.9987 -0.9715 1.0272 F1(:,:,90) = -0.8836 -2.1694 0.7142 -0.9729 -2.2677 1.7052 -3.9548 -1.4461 0.5086 F1(:,:,91) = -0.7162 -2.3057 0.4105 -0.8877 -2.5147 1.3731 -3.8129 -1.8578 -0.0449 F1(:,:,92) = -0.5075 -2.3930 0.1145 -0.7463 -2.7164 1.0299 -3.5771 -2.1940 -0.6168 F1(:,:,93) = -0.2638 -2.4290 -0.1651 -0.5528 -2.8670 0.6858 -3.2547 -2.4451 -1.1903 F1(:,:,94) = 0.0235 -2.4101 -0.4336 -0.2985 -2.9659 0.3325 -2.8308 -2.6099 -1.7791 F1(:,:,95) = 0.3321 -2.3334 -0.6655 -0.0010 -2.9995 0.0015 -2.3351 -2.6659 -2.3308 F1(:,:,96) = 0.6518 -2.2011 -0.8529 0.3297 -2.9665 -0.2962 -1.7839 -2.6108 -2.8269 F1(:,:,97) = 0.9721 -2.0178 -0.9899 0.6827 -2.8681 -0.5508 -1.1955 -2.4469 -3.2514 F1(:,:,98) = 1.2587 -1.8090 -1.0677 1.0179 -2.7225 -0.7403 -0.6369 -2.2041 -3.5672 F1(:,:,99) = 1.5285 -1.5680 -1.0965 1.3525 -2.5282 -0.8806 -0.0792 -1.8803 -3.8011 F1(:,:,100) = 1.7739 -1.3014 -1.0753 1.6770 -2.2907 -0.9677 0.4617 -1.4844 -3.9461 F1(:,:,101) = 1.9880 -1.0170 -1.0050 1.9825 -2.0167 -0.9991 0.9708 -1.0278 -3.9986 F1(:,:,102) = 2.1419 -0.7653 -0.9072 2.2223 -1.7590 -0.9813 1.3704 -0.5984 -3.9688 F1(:,:,103) = 2.2653 -0.5116 -0.7768 2.4367 -1.4857 -0.9224 1.7279 -0.1428 -3.8707 F1(:,:,104) = 2.3555 -0.2611 -0.6166 2.6214 -1.2023 -0.8237 2.0356 0.3295 -3.7061 F1(:,:,105) = 2.4107 -0.0190 -0.4297 2.7724 -0.9147 -0.6872 2.2874 0.8088 -3.4786
odefun2 = @(t,R)fun2(t,R,R1,R2);
[T,F2] = ode45(odefun2,tspan,R2);
F2 = reshape(F2.',3,3,[])
F2 =
F2(:,:,1) = 1 5 3 3 1 2 2 6 4 F2(:,:,2) = 1.0502 5.0123 2.9621 3.0187 0.9936 1.9748 2.0627 6.0122 3.9495 F2(:,:,3) = 1.1002 5.0240 2.9239 3.0373 0.9869 1.9496 2.1251 6.0237 3.8986 F2(:,:,4) = 1.1500 5.0352 2.8852 3.0556 0.9799 1.9243 2.1873 6.0345 3.8472 F2(:,:,5) = 1.1996 5.0458 2.8462 3.0738 0.9727 1.8989 2.2492 6.0445 3.7953 F2(:,:,6) = 1.4450 5.0905 2.6455 3.1613 0.9324 1.7711 2.5547 6.0841 3.5294 F2(:,:,7) = 1.6852 5.1212 2.4360 3.2434 0.8854 1.6420 2.8526 6.1057 3.2531 F2(:,:,8) = 1.9194 5.1376 2.2183 3.3199 0.8319 1.5119 3.1421 6.1093 2.9672 F2(:,:,9) = 2.1469 5.1399 1.9930 3.3906 0.7719 1.3814 3.4223 6.0947 2.6724 F2(:,:,10) = 2.8393 5.0479 1.2085 3.5788 0.5324 0.9536 4.2675 5.9211 1.6536 F2(:,:,11) = 3.4307 4.8058 0.3751 3.6956 0.2336 0.5379 4.9767 5.5591 0.5824 F2(:,:,12) = 3.9019 4.4212 -0.4807 3.7371 -0.1152 0.1477 5.5271 5.0199 -0.5072 F2(:,:,13) = 4.2384 3.9065 -1.3319 3.7020 -0.5027 -0.2048 5.9016 4.3209 -1.5807 F2(:,:,14) = 4.4355 3.2453 -2.1902 3.5847 -0.9373 -0.5219 6.0934 3.4411 -2.6522 F2(:,:,15) = 4.4659 2.4824 -2.9835 3.3886 -1.3856 -0.7742 6.0720 2.4412 -3.6309 F2(:,:,16) = 4.3279 1.6443 -3.6836 3.1205 -1.8319 -0.9524 5.8377 1.3558 -4.4819 F2(:,:,17) = 4.0269 0.7603 -4.2666 2.7899 -2.2609 -1.0508 5.3993 0.2230 -5.1763 F2(:,:,18) = 3.5965 -0.0998 -4.6964 2.4259 -2.6413 -1.0672 4.8034 -0.8687 -5.6722 F2(:,:,19) = 3.0405 -0.9460 -4.9865 2.0270 -2.9797 -1.0067 4.0540 -1.9325 -5.9864 F2(:,:,20) = 2.3763 -1.7509 -5.1272 1.6059 -3.2653 -0.8712 3.1746 -2.9340 -6.1086 F2(:,:,21) = 1.6253 -2.4892 -5.1145 1.1761 -3.4890 -0.6651 2.1936 -3.8417 -6.0352 F2(:,:,22) = 0.7838 -3.1575 -4.9413 0.7372 -3.6480 -0.3853 1.1065 -4.6508 -5.7573 F2(:,:,23) = -0.0957 -3.7063 -4.6106 0.3188 -3.7279 -0.0467 -0.0183 -5.3009 -5.2827 F2(:,:,24) = -0.9832 -4.1167 -4.1335 -0.0647 -3.7257 0.3390 -1.1421 -5.7693 -4.6272 F2(:,:,25) = -1.8485 -4.3751 -3.5265 -0.4005 -3.6418 0.7588 -2.2271 -6.0406 -3.8135 F2(:,:,26) = -2.6341 -4.4725 -2.8384 -0.6685 -3.4865 1.1820 -3.2014 -6.1076 -2.9062 F2(:,:,27) = -3.3465 -4.4174 -2.0709 -0.8728 -3.2629 1.6099 -4.0740 -5.9807 -1.9068 F2(:,:,28) = -3.9630 -4.2113 -1.2483 -1.0070 -2.9780 2.0290 -4.8168 -5.6637 -0.8469 F2(:,:,29) = -4.4643 -3.8609 -0.3966 -1.0669 -2.6409 2.4260 -5.4069 -5.1670 0.2399 F2(:,:,30) = -4.8412 -3.3667 0.4745 -1.0499 -2.2543 2.7956 -5.8328 -4.4918 1.3410 F2(:,:,31) = -5.0692 -2.7505 1.3188 -0.9541 -1.8374 3.1167 -6.0660 -3.6683 2.3976 F2(:,:,32) = -5.1403 -2.0322 2.1081 -0.7826 -1.4039 3.3788 -6.0983 -2.7236 3.3747 F2(:,:,33) = -5.0527 -1.2358 2.8170 -0.5412 -0.9680 3.5733 -5.9292 -1.6889 4.2403 F2(:,:,34) = -4.7978 -0.3552 3.4426 -0.2257 -0.5286 3.6972 -5.5477 -0.5569 4.9908 F2(:,:,35) = -4.3843 0.5497 3.9341 0.1451 -0.1178 3.7370 -4.9692 0.5946 5.5638 F2(:,:,36) = -3.8266 1.4467 4.2733 0.5582 0.2495 3.6913 -4.2138 1.7246 5.9384 F2(:,:,37) = -3.1447 2.3042 4.4489 0.9989 0.5606 3.5617 -3.3085 2.7935 6.1021 F2(:,:,38) = -2.4280 3.0329 4.4609 1.4156 0.7881 3.3724 -2.3704 3.6914 6.0618 F2(:,:,39) = -1.6483 3.6802 4.3285 1.8298 0.9516 3.1218 -1.3610 4.4778 5.8388 F2(:,:,40) = -0.8290 4.2262 4.0553 2.2289 1.0460 2.8171 -0.3106 5.1289 5.4395 F2(:,:,41) = 0.0052 4.6550 3.6498 2.6010 1.0688 2.4677 0.7491 5.6254 4.8762 F2(:,:,42) = 0.8801 4.9682 3.0881 2.9545 1.0139 2.0594 1.8500 5.9676 4.1177 F2(:,:,43) = 1.7135 5.1237 2.4102 3.2529 0.8793 1.6264 2.8877 6.1069 3.2192 F2(:,:,44) = 2.4770 5.1159 1.6389 3.4857 0.6692 1.1836 3.8267 6.0379 2.2112 F2(:,:,45) = 3.1449 4.9454 0.8005 3.6453 0.3910 0.7457 4.6357 5.7636 1.1279 F2(:,:,46) = 3.7148 4.6023 -0.1125 3.7283 0.0397 0.3114 5.3107 5.2711 -0.0395 F2(:,:,47) = 4.1355 4.1022 -1.0333 3.7231 -0.3621 -0.0852 5.7901 4.5848 -1.2053 F2(:,:,48) = 4.3912 3.4631 -1.9282 3.6297 -0.7997 -0.4294 6.0556 3.7293 -2.3263 F2(:,:,49) = 4.4731 2.7087 -2.7644 3.4517 -1.2570 -0.7087 6.0983 2.7365 -3.3618 F2(:,:,50) = 4.4029 1.9916 -3.4113 3.2371 -1.6518 -0.8889 5.9568 1.8042 -4.1526 F2(:,:,51) = 4.2047 1.2298 -3.9749 2.9710 -2.0379 -1.0089 5.6542 0.8232 -4.8310 F2(:,:,52) = 3.8835 0.4438 -4.4397 2.6606 -2.4049 -1.0655 5.1984 -0.1799 -5.3783 F2(:,:,53) = 3.4482 -0.3452 -4.7934 2.3142 -2.7429 -1.0571 4.6020 -1.1782 -5.7802 F2(:,:,54) = 2.8271 -1.2229 -5.0500 1.8868 -3.0820 -0.9688 3.7701 -2.2782 -6.0483 F2(:,:,55) = 2.0948 -2.0456 -5.1403 1.4400 -3.3595 -0.7995 2.8054 -3.2976 -6.1031 F2(:,:,56) = 1.2767 -2.7839 -5.0607 0.9895 -3.5652 -0.5547 1.7418 -4.2003 -5.9421 F2(:,:,57) = 0.4019 -3.4125 -4.8144 0.5511 -3.6923 -0.2434 0.6167 -4.9550 -5.5717 F2(:,:,58) = -0.5315 -3.9250 -4.3935 0.1259 -3.7367 0.1374 -0.5715 -5.5533 -4.9818 F2(:,:,59) = -1.4572 -4.2763 -3.8191 -0.2535 -3.6902 0.5634 -1.7378 -5.9415 -4.2037 F2(:,:,60) = -2.3400 -4.4526 -3.1126 -0.5726 -3.5542 1.0184 -2.8379 -6.1042 -3.2663 F2(:,:,61) = -3.1471 -4.4480 -2.3009 -0.8197 -3.3343 1.4855 -3.8309 -6.0361 -2.2052 F2(:,:,62) = -3.7583 -4.2995 -1.5412 -0.9678 -3.0840 1.8838 -4.5717 -5.7949 -1.2232 F2(:,:,63) = -4.2732 -4.0210 -0.7477 -1.0513 -2.7847 2.2666 -5.1841 -5.3910 -0.2070 F2(:,:,64) = -4.6773 -3.6201 0.0573 -1.0677 -2.4446 2.6231 -5.6506 -4.8357 0.8149 F2(:,:,65) = -4.9595 -3.1082 0.8514 -1.0167 -2.0733 2.9434 -5.9585 -4.1445 1.8140 F2(:,:,66) = -5.1171 -2.4620 1.6551 -0.8912 -1.6581 3.2331 -6.1027 -3.2875 2.8152 F2(:,:,67) = -5.1245 -1.7283 2.3962 -0.6959 -1.2328 3.4631 -6.0554 -2.3274 3.7280 F2(:,:,68) = -4.9810 -0.9298 3.0513 -0.4368 -0.8107 3.6261 -5.8174 -1.2942 4.5232 F2(:,:,69) = -4.6917 -0.0916 3.6001 -0.1221 -0.4051 3.7170 -5.3968 -0.2204 5.1764 F2(:,:,70) = -4.2127 0.8513 4.0640 0.2792 0.0099 3.7308 -4.7347 0.9758 5.7105 F2(:,:,71) = -3.5845 1.7741 4.3585 0.7209 0.3732 3.6523 -3.8906 2.1341 6.0247 F2(:,:,72) = -2.8309 2.6410 4.4719 1.1861 0.6704 3.4843 -2.8964 3.2098 6.1063 F2(:,:,73) = -1.9812 3.4192 4.4004 1.6571 0.8906 3.2335 -1.7908 4.1621 5.9529 F2(:,:,74) = -1.1906 4.0002 4.1908 2.0568 1.0130 2.9562 -0.7730 4.8611 5.6341 F2(:,:,75) = -0.3752 4.4747 3.8498 2.4354 1.0672 2.6317 0.2671 5.4188 5.1517 F2(:,:,76) = 0.4413 4.8285 3.3872 2.7819 1.0515 2.2696 1.2992 5.8187 4.5195 F2(:,:,77) = 1.2353 5.0518 2.8165 3.0863 0.9665 1.8802 2.2936 6.0496 3.7560 F2(:,:,78) = 2.0115 5.1390 2.1275 3.3487 0.8079 1.4592 3.2556 6.1040 2.8484 F2(:,:,79) = 2.7142 5.0758 1.3616 3.5479 0.5822 1.0344 4.1156 5.9673 1.8517 F2(:,:,80) = 3.3211 4.8639 0.5427 3.6775 0.2965 0.6190 4.8463 5.6434 0.7971 F2(:,:,81) = 3.8137 4.5101 -0.3036 3.7339 -0.0402 0.2260 5.4254 5.1429 -0.2824 F2(:,:,82) = 4.2121 3.9587 -1.2534 3.7080 -0.4656 -0.1735 5.8732 4.3912 -1.4821 F2(:,:,83) = 4.4314 3.2646 -2.1668 3.5886 -0.9250 -0.5136 6.0897 3.4667 -2.6231 F2(:,:,84) = 4.4623 2.4548 -3.0075 3.3801 -1.4005 -0.7806 6.0655 2.4054 -3.6601 F2(:,:,85) = 4.3044 1.5615 -3.7430 3.0910 -1.8734 -0.9644 5.8025 1.2493 -4.5532 F2(:,:,86) = 4.0171 0.7400 -4.2772 2.7814 -2.2700 -1.0514 5.3857 0.1971 -5.1886 F2(:,:,87) = 3.5989 -0.0937 -4.6926 2.4283 -2.6384 -1.0667 4.8069 -0.8609 -5.6677 F2(:,:,88) = 3.0622 -0.9142 -4.9765 2.0422 -2.9673 -1.0095 4.0832 -1.8927 -5.9759 F2(:,:,89) = 2.4233 -1.6973 -5.1207 1.6348 -3.2471 -0.8819 3.2366 -2.8676 -6.1042 F2(:,:,90) = 1.6992 -2.4219 -5.1210 1.2169 -3.4701 -0.6870 2.2896 -3.7593 -6.0489 F2(:,:,91) = 0.9136 -3.0628 -4.9764 0.8027 -3.6284 -0.4310 1.2734 -4.5371 -5.8105 F2(:,:,92) = 0.0903 -3.6006 -4.6909 0.4046 -3.7170 -0.1215 0.2188 -5.1770 -5.3958 F2(:,:,93) = -0.7458 -4.0193 -4.2735 0.0345 -3.7334 0.2320 -0.8425 -5.6602 -4.8177 F2(:,:,94) = -1.6707 -4.3331 -3.6624 -0.3345 -3.6654 0.6691 -2.0049 -5.9993 -3.9944 F2(:,:,95) = -2.5441 -4.4680 -2.9239 -0.6396 -3.5081 1.1314 -3.0903 -6.1086 -3.0184 F2(:,:,96) = -3.3323 -4.4185 -2.0861 -0.8688 -3.2673 1.6014 -4.0566 -5.9832 -1.9266 F2(:,:,97) = -4.0059 -4.1869 -1.1811 -1.0137 -2.9524 2.0612 -4.8677 -5.6286 -0.7609 F2(:,:,98) = -4.4924 -3.8313 -0.3389 -1.0676 -2.6162 2.4514 -5.4392 -5.1261 0.3131 F2(:,:,99) = -4.8502 -3.3468 0.5034 -1.0473 -2.2404 2.8069 -5.8423 -4.4650 1.3773 F2(:,:,100) = -5.0677 -2.7482 1.3195 -0.9530 -1.8365 3.1165 -6.0640 -3.6655 2.3985 F2(:,:,101) = -5.1387 -2.0541 2.0846 -0.7880 -1.4170 3.3711 -6.0980 -2.7524 3.3455 F2(:,:,102) = -5.1219 -1.7130 2.4089 -0.6910 -1.2247 3.4663 -6.0510 -2.3076 3.7434 F2(:,:,103) = -5.0745 -1.3588 2.7157 -0.5810 -1.0331 3.5479 -5.9654 -1.8480 4.1173 F2(:,:,104) = -4.9966 -0.9937 3.0029 -0.4588 -0.8434 3.6154 -5.8415 -1.3766 4.4649 F2(:,:,105) = -4.8889 -0.6201 3.2688 -0.3251 -0.6569 3.6682 -5.6802 -0.8964 4.7838
function dR = fun1(t,R,R1,R2)
F1 = reshape(R,size(R1));
W_12 = (R1'*R2-R2'*R1);
FA = F1*sign(W_12);
dR = FA(:);
end
function dR = fun2(t,R,R1,R2)
F2 = reshape(R,size(R2));
W_21 = sign(R2'*R1-R1'*R2);
W_2 = W_21;
FA = F2*W_2;
dR = FA(:);
end
The results obtained F1 and F2 representing (R1 and R2) does not have same dimension. Also the result does not seen correct.

Accepted Answer

Torsten
Torsten on 26 Feb 2023
Edited: Torsten on 26 Feb 2023
I took R10, R20 as initial conditions for your matrix equations.
I formed W1, W2 with the matrices R1 and R2 at time t. You formed W1, W2 with the matrices R1 and R2 at time t = 0. According to your problem formulation, my interpretation should be correct, but maybe I'm wrong and you have to correct the code accordingly.
R10 = [1 1 2; 2 1 2; 1 4 1];
R20 = [1 5 3; 3 1 2; 2 6 4];
tspan = [0 10];
for i = 1:3
for j = 1:3
y0((i-1)*3 + j) = R10(i,j);
y0(9 + (i-1)*3 + j) = R20(i,j);
end
end
[T,Y] = ode45(@fun,tspan,y0);
for k = 1:numel(T)
for i = 1:3
for j = 1:3
R1(k,i,j) = Y(k,(i-1)*3 + j);
R2(k,i,j) = Y(k,9 + (i-1)*3 + j);
end
end
end
squeeze(R1(1,:,:))
ans = 3×3
1 1 2 2 1 2 1 4 1
squeeze(R2(1,:,:))
ans = 3×3
1 5 3 3 1 2 2 6 4
squeeze(R1(end,:,:))
ans = 3×3
1.2795 1.0035 2.2140 2.3594 1.0856 2.1774 0.9483 4.3300 1.3602
squeeze(R2(end,:,:))
ans = 3×3
1.3812 5.5761 2.9993 3.2683 1.0234 2.4825 2.5123 6.6650 4.1370
function dy = fun(t,y)
for i = 1:3
for j = 1:3
R1(i,j) = y((i-1)*3 + j);
R2(i,j) = y(9 + (i-1)*3 + j);
end
end
mat = R1.'*R2 - R2.'*R1;
W1 = sign(mat);
W2 = -W1;
R1dot = R1*W1;
R2dot = R2*W2;
dy = zeros(18,1);
for i = 1:3
for j = 1:3
dy((i-1)*3 + j) = R1dot(i,j);
dy(9 + (i-1)*3 + j) = R2dot(i,j);
end
end
end

More Answers (2)

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 24 Feb 2023
It looks likse sizes F1 and F2 are coherent with R1 and R2.
The only question in your given exercise is R1' and R2' are transposes or derivatives of R1 and R2. The results may differ because of this significantly.
If your are thinking of how many sets of W1 and W2 are obtained, it is linked with the number of iterations performed. The number of iterations are taken by ode45 by a variable step by default when two boundaries of tspan are given. The number of iterations can be controlled by specifying t values and/or error tolerances of ode45 using odeset() .
R1 = [1 1 2; 2 1 2; 1 4 1];
R2 = [1 5 3; 3 1 2; 2 6 4];
% tspan = [0 10];
tspan = linspace(0, 10, 200); % 200 sets of solutions are obtained
% OPTs = odeset('reltol', 1e-5, 'abstol', 1e-7);
odefun1 = @(t,R)fun1(t,R,R1,R2);
[T,F1] = ode45(odefun1,tspan,R1);
% [T,F1] = ode45(odefun1,tspan,R1, OPTs);
F1 = reshape(F1.',3,3,[])
F1 =
F1(:,:,1) = 1 1 2 2 1 2 1 4 1 F1(:,:,2) = 0.8482 0.9435 2.0953 1.8457 0.9924 2.1468 0.7428 3.9874 1.2446 F1(:,:,3) = 0.6950 0.8748 2.1798 1.6849 0.9698 2.2849 0.4748 3.9496 1.4748 F1(:,:,4) = 0.5416 0.7945 2.2529 1.5190 0.9322 2.4132 0.1983 3.8870 1.6887 F1(:,:,5) = 0.3891 0.7030 2.3139 1.3491 0.8800 2.5309 -0.0848 3.8000 1.8849 F1(:,:,6) = 0.2387 0.6012 2.3625 1.1766 0.8136 2.6370 -0.3724 3.6893 2.0617 F1(:,:,7) = 0.0916 0.4898 2.3983 1.0027 0.7334 2.7307 -0.6622 3.5557 2.2179 F1(:,:,8) = -0.0513 0.3697 2.4210 0.8288 0.6401 2.8114 -0.9520 3.4002 2.3523 F1(:,:,9) = -0.1886 0.2417 2.4303 0.6562 0.5345 2.8783 -1.2397 3.2241 2.4638 F1(:,:,10) = -0.3195 0.1068 2.4263 0.4862 0.4171 2.9309 -1.5229 3.0286 2.5515 F1(:,:,11) = -0.4428 -0.0339 2.4090 0.3202 0.2891 2.9689 -1.7997 2.8151 2.6148 F1(:,:,12) = -0.5578 -0.1794 2.3784 0.1593 0.1512 2.9920 -2.0679 2.5854 2.6533 F1(:,:,13) = -0.6635 -0.3286 2.3349 0.0047 0.0047 3.0000 -2.3254 2.3412 2.6666 F1(:,:,14) = -0.7592 -0.4804 2.2788 -0.1423 -0.1494 2.9929 -2.5705 2.0843 2.6548 F1(:,:,15) = -0.8441 -0.6336 2.2105 -0.2808 -0.3100 2.9707 -2.8013 1.8166 2.6179 F1(:,:,16) = -0.9176 -0.7871 2.1305 -0.4095 -0.4759 2.9337 -3.0159 1.5402 2.5561 F1(:,:,17) = -0.9790 -0.9396 2.0394 -0.5276 -0.6456 2.8819 -3.2126 1.2573 2.4699 F1(:,:,18) = -1.0280 -1.0900 1.9379 -0.6340 -0.8181 2.8159 -3.3900 0.9699 2.3599 F1(:,:,19) = -1.0641 -1.2373 1.8268 -0.7280 -0.9919 2.7362 -3.5467 0.6802 2.2269 F1(:,:,20) = -1.0870 -1.3802 1.7069 -0.8090 -1.1657 2.6432 -3.6816 0.3904 2.0720 F1(:,:,21) = -1.0968 -1.5177 1.5791 -0.8762 -1.3384 2.5378 -3.7937 0.1027 1.8964 F1(:,:,22) = -1.0932 -1.6488 1.4444 -0.9293 -1.5085 2.4209 -3.8822 -0.1808 1.7015 F1(:,:,23) = -1.0763 -1.7725 1.3038 -0.9679 -1.6748 2.2931 -3.9465 -0.4579 1.4886 F1(:,:,24) = -1.0462 -1.8878 1.1584 -0.9916 -1.8359 2.1556 -3.9859 -0.7266 1.2594 F1(:,:,25) = -1.0032 -1.9939 1.0093 -1.0001 -1.9907 2.0094 -4.0002 -0.9846 1.0156 F1(:,:,26) = -0.9475 -2.0898 0.8576 -0.9935 -2.1380 1.8555 -3.9891 -1.2300 0.7591 F1(:,:,27) = -0.8795 -2.1750 0.7045 -0.9717 -2.2766 1.6951 -3.9528 -1.4610 0.4918 F1(:,:,28) = -0.7998 -2.2487 0.5511 -0.9350 -2.4056 1.5294 -3.8916 -1.6759 0.2157 F1(:,:,29) = -0.7090 -2.3105 0.3985 -0.8836 -2.5239 1.3597 -3.8060 -1.8731 -0.0671 F1(:,:,30) = -0.6078 -2.3598 0.2480 -0.8180 -2.6307 1.1873 -3.6967 -2.0512 -0.3545 F1(:,:,31) = -0.4970 -2.3964 0.1005 -0.7387 -2.7253 1.0134 -3.5645 -2.2088 -0.6443 F1(:,:,32) = -0.3773 -2.4199 -0.0426 -0.6463 -2.8068 0.8395 -3.4104 -2.3447 -0.9342 F1(:,:,33) = -0.2498 -2.4302 -0.1804 -0.5413 -2.8746 0.6668 -3.2356 -2.4576 -1.2221 F1(:,:,34) = -0.1154 -2.4270 -0.3116 -0.4247 -2.9281 0.4966 -3.0412 -2.5469 -1.5057 F1(:,:,35) = 0.0250 -2.4104 -0.4355 -0.2973 -2.9670 0.3303 -2.8288 -2.6117 -1.7828 F1(:,:,36) = 0.1703 -2.3807 -0.5510 -0.1600 -2.9910 0.1691 -2.6000 -2.6516 -2.0516 F1(:,:,37) = 0.3193 -2.3379 -0.6572 -0.0140 -2.9999 0.0141 -2.3566 -2.6664 -2.3098 F1(:,:,38) = 0.4710 -2.2825 -0.7535 0.1398 -2.9936 -0.1334 -2.1004 -2.6561 -2.5557 F1(:,:,39) = 0.6241 -2.2149 -0.8391 0.3000 -2.9724 -0.2724 -1.8333 -2.6207 -2.7873 F1(:,:,40) = 0.7776 -2.1357 -0.9133 0.4655 -2.9363 -0.4018 -1.5574 -2.5604 -3.0030 F1(:,:,41) = 0.9303 -2.0453 -0.9755 0.6351 -2.8854 -0.5205 -1.2748 -2.4757 -3.2009 F1(:,:,42) = 1.0809 -1.9444 -1.0253 0.8074 -2.8203 -0.6277 -0.9876 -2.3672 -3.3796 F1(:,:,43) = 1.2283 -1.8339 -1.0622 0.9812 -2.7414 -0.7226 -0.6981 -2.2357 -3.5376 F1(:,:,44) = 1.3715 -1.7145 -1.0860 1.1551 -2.6493 -0.8043 -0.4082 -2.0821 -3.6739 F1(:,:,45) = 1.5093 -1.5872 -1.0965 1.3278 -2.5446 -0.8724 -0.1204 -1.9077 -3.7874 F1(:,:,46) = 1.6408 -1.4529 -1.0937 1.4980 -2.4283 -0.9264 0.1634 -1.7139 -3.8773 F1(:,:,47) = 1.7650 -1.3126 -1.0776 1.6646 -2.3012 -0.9658 0.4409 -1.5021 -3.9430 F1(:,:,48) = 1.8809 -1.1675 -1.0483 1.8261 -2.1643 -0.9904 0.7102 -1.2738 -3.9840 F1(:,:,49) = 1.9875 -1.0186 -1.0061 1.9814 -2.0185 -0.9999 0.9689 -1.0309 -3.9998 F1(:,:,50) = 2.0842 -0.8670 -0.9512 2.1292 -1.8651 -0.9942 1.2153 -0.7751 -3.9904 F1(:,:,51) = 2.1700 -0.7139 -0.8840 2.2683 -1.7051 -0.9734 1.4472 -0.5084 -3.9557 F1(:,:,52) = 2.2445 -0.5605 -0.8050 2.3979 -1.5397 -0.9376 1.6632 -0.2328 -3.8960 F1(:,:,53) = 2.3070 -0.4079 -0.7148 2.5169 -1.3703 -0.8871 1.8615 0.0496 -3.8119 F1(:,:,54) = 2.3570 -0.2572 -0.6142 2.6244 -1.1980 -0.8224 2.0406 0.3367 -3.7040 F1(:,:,55) = 2.3944 -0.1096 -0.5040 2.7197 -1.0242 -0.7439 2.1994 0.6263 -3.5731 F1(:,:,56) = 2.4187 0.0338 -0.3849 2.8020 -0.8502 -0.6522 2.3366 0.9163 -3.4203 F1(:,:,57) = 2.4298 0.1720 -0.2578 2.8707 -0.6774 -0.5480 2.4511 1.2044 -3.2467 F1(:,:,58) = 2.4275 0.3037 -0.1237 2.9252 -0.5070 -0.4321 2.5419 1.4884 -3.0536 F1(:,:,59) = 2.4118 0.4281 0.0163 2.9650 -0.3404 -0.3054 2.6084 1.7661 -2.8423 F1(:,:,60) = 2.3829 0.5441 0.1613 2.9899 -0.1788 -0.1687 2.6499 2.0354 -2.6145 F1(:,:,61) = 2.3409 0.6510 0.3101 2.9997 -0.0234 -0.0232 2.6662 2.2943 -2.3720 F1(:,:,62) = 2.2862 0.7478 0.4616 2.9944 0.1245 0.1301 2.6573 2.5409 -2.1165 F1(:,:,63) = 2.2194 0.8340 0.6147 2.9740 0.2640 0.2900 2.6234 2.7733 -1.8500 F1(:,:,64) = 2.1408 0.9089 0.7681 2.9388 0.3940 0.4552 2.5646 2.9900 -1.5746 F1(:,:,65) = 2.0510 0.9719 0.9209 2.8888 0.5134 0.6246 2.4814 3.1891 -1.2923 F1(:,:,66) = 1.9508 1.0225 1.0717 2.8246 0.6214 0.7968 2.3744 3.3690 -1.0053 F1(:,:,67) = 1.8409 1.0602 1.2194 2.7466 0.7171 0.9705 2.2443 3.5285 -0.7158 F1(:,:,68) = 1.7220 1.0849 1.3628 2.6553 0.7997 1.1444 2.0921 3.6661 -0.4260 F1(:,:,69) = 1.5952 1.0962 1.5010 2.5514 0.8686 1.3172 1.9190 3.7810 -0.1380 F1(:,:,70) = 1.4613 1.0942 1.6329 2.4358 0.9234 1.4876 1.7263 3.8724 0.1461 F1(:,:,71) = 1.3214 1.0789 1.7575 2.3093 0.9637 1.6544 1.5155 3.9394 0.4240 F1(:,:,72) = 1.1765 1.0504 1.8738 2.1729 0.9891 1.8162 1.2882 3.9819 0.6937 F1(:,:,73) = 1.0278 1.0089 1.9811 2.0277 0.9995 1.9719 1.0461 3.9992 0.9532 F1(:,:,74) = 0.8763 0.9548 2.0784 1.8746 0.9949 2.1202 0.7910 3.9914 1.2004 F1(:,:,75) = 0.7233 0.8883 2.1650 1.7150 0.9750 2.2600 0.5250 3.9584 1.4334 F1(:,:,76) = 0.5699 0.8101 2.2402 1.5499 0.9402 2.3903 0.2499 3.9003 1.6504 F1(:,:,77) = 0.4172 0.7207 2.3035 1.3807 0.8906 2.5099 -0.0321 3.8177 1.8498 F1(:,:,78) = 0.2664 0.6207 2.3543 1.2086 0.8267 2.6181 -0.3189 3.7112 2.0302 F1(:,:,79) = 0.1186 0.5110 2.3924 1.0349 0.7490 2.7141 -0.6084 3.5817 2.1901 F1(:,:,80) = -0.0250 0.3924 2.4174 0.8610 0.6581 2.7971 -0.8983 3.4302 2.3285 F1(:,:,81) = -0.1635 0.2658 2.4293 0.6880 0.5547 2.8666 -1.1866 3.2578 2.4444 F1(:,:,82) = -0.2957 0.1321 2.4278 0.5174 0.4394 2.9220 -1.4710 3.0657 2.5367 F1(:,:,83) = -0.4206 -0.0076 2.4130 0.3505 0.3133 2.9629 -1.7492 2.8556 2.6048 F1(:,:,84) = -0.5373 -0.1523 2.3850 0.1885 0.1773 2.9888 -2.0192 2.6288 2.6480 F1(:,:,85) = -0.6447 -0.3009 2.3439 0.0327 0.0323 2.9996 -2.2788 2.3872 2.6660 F1(:,:,86) = -0.7422 -0.4522 2.2900 -0.1157 -0.1205 2.9952 -2.5262 2.1325 2.6587 F1(:,:,87) = -0.8290 -0.6052 2.2238 -0.2557 -0.2800 2.9757 -2.7595 1.8667 2.6262 F1(:,:,88) = -0.9045 -0.7587 2.1458 -0.3862 -0.4449 2.9412 -2.9770 1.5918 2.5687 F1(:,:,89) = -0.9682 -0.9114 2.0568 -0.5062 -0.6141 2.8922 -3.1770 1.3099 2.4869 F1(:,:,90) = -1.0195 -1.0624 1.9571 -0.6149 -0.7861 2.8288 -3.3582 1.0231 2.3813 F1(:,:,91) = -1.0581 -1.2104 1.8478 -0.7114 -0.9598 2.7516 -3.5190 0.7336 2.2526 F1(:,:,92) = -1.0837 -1.3542 1.7295 -0.7949 -1.1338 2.6611 -3.6582 0.4437 2.1019 F1(:,:,93) = -1.0959 -1.4927 1.6031 -0.8648 -1.3067 2.5581 -3.7746 0.1555 1.9301 F1(:,:,94) = -1.0947 -1.6250 1.4697 -0.9205 -1.4773 2.4432 -3.8675 -0.1288 1.7386 F1(:,:,95) = -1.0802 -1.7500 1.3301 -0.9616 -1.6443 2.3173 -3.9360 -0.4071 1.5289 F1(:,:,96) = -1.0524 -1.8669 1.1855 -0.9879 -1.8064 2.1815 -3.9798 -0.6773 1.3025 F1(:,:,97) = -1.0117 -1.9746 1.0371 -0.9992 -1.9624 2.0368 -3.9986 -0.9373 1.0613 F1(:,:,98) = -0.9583 -2.0726 0.8857 -0.9954 -2.1112 1.8842 -3.9923 -1.1853 0.8070 F1(:,:,99) = -0.8926 -2.1599 0.7327 -0.9765 -2.2516 1.7249 -3.9608 -1.4193 0.5415 F1(:,:,100) = -0.8151 -2.2359 0.5793 -0.9426 -2.3825 1.5601 -3.9044 -1.6375 0.2669 F1(:,:,101) = -0.7264 -2.2999 0.4265 -0.8940 -2.5029 1.3912 -3.8234 -1.8381 -0.0147 F1(:,:,102) = -0.6271 -2.3516 0.2755 -0.8310 -2.6118 1.2192 -3.7184 -2.0197 -0.3013 F1(:,:,103) = -0.5180 -2.3904 0.1276 -0.7542 -2.7085 1.0456 -3.5903 -2.1809 -0.5906 F1(:,:,104) = -0.3999 -2.4162 -0.0163 -0.6640 -2.7923 0.8717 -3.4400 -2.3205 -0.8805 F1(:,:,105) = -0.2737 -2.4288 -0.1551 -0.5613 -2.8626 0.6987 -3.2688 -2.4376 -1.1688 F1(:,:,106) = -0.1405 -2.4281 -0.2876 -0.4467 -2.9188 0.5280 -3.0779 -2.5313 -1.4534 F1(:,:,107) = -0.0011 -2.4141 -0.4130 -0.3213 -2.9605 0.3607 -2.8688 -2.6009 -1.7321 F1(:,:,108) = 0.1433 -2.3869 -0.5302 -0.1858 -2.9874 0.1984 -2.6430 -2.6457 -2.0027 F1(:,:,109) = 0.2917 -2.3466 -0.6383 -0.0414 -2.9992 0.0421 -2.4023 -2.6654 -2.2631 F1(:,:,110) = 0.4429 -2.2936 -0.7365 0.1110 -2.9958 -0.1068 -2.1484 -2.6597 -2.5113 F1(:,:,111) = 0.5958 -2.2282 -0.8240 0.2700 -2.9773 -0.2473 -1.8833 -2.6288 -2.7456 F1(:,:,112) = 0.7492 -2.1510 -0.9002 0.4347 -2.9438 -0.3784 -1.6089 -2.5729 -2.9640 F1(:,:,113) = 0.9021 -2.0625 -0.9646 0.6036 -2.8955 -0.4991 -1.3274 -2.4925 -3.1651 F1(:,:,114) = 1.0531 -1.9635 -1.0166 0.7754 -2.8330 -0.6084 -1.0409 -2.3883 -3.3474 F1(:,:,115) = 1.2013 -1.8547 -1.0560 0.9491 -2.7566 -0.7057 -0.7516 -2.2610 -3.5094 F1(:,:,116) = 1.3454 -1.7369 -1.0823 1.1231 -2.6669 -0.7900 -0.4616 -2.1115 -3.6500 F1(:,:,117) = 1.4843 -1.6111 -1.0954 1.2961 -2.5646 -0.8607 -0.1732 -1.9410 -3.7679 F1(:,:,118) = 1.6170 -1.4780 -1.0950 1.4669 -2.4505 -0.9173 0.1114 -1.7508 -3.8622 F1(:,:,119) = 1.7425 -1.3388 -1.0814 1.6341 -2.3253 -0.9594 0.3901 -1.5422 -3.9323 F1(:,:,120) = 1.8599 -1.1946 -1.0544 1.7965 -2.1901 -0.9866 0.6608 -1.3169 -3.9777 F1(:,:,121) = 1.9682 -1.0463 -1.0145 1.9529 -2.0459 -0.9988 0.9215 -1.0765 -3.9980 F1(:,:,122) = 2.0667 -0.8951 -0.9619 2.1021 -1.8938 -0.9959 1.1702 -0.8230 -3.9932 F1(:,:,123) = 2.1547 -0.7422 -0.8969 2.2431 -1.7349 -0.9779 1.4051 -0.5581 -3.9632 F1(:,:,124) = 2.2314 -0.5888 -0.8201 2.3746 -1.5704 -0.9450 1.6243 -0.2840 -3.9083 F1(:,:,125) = 2.2962 -0.4359 -0.7321 2.4956 -1.4017 -0.8973 1.8260 -0.0028 -3.8288 F1(:,:,126) = 2.3486 -0.2848 -0.6334 2.6053 -1.2299 -0.8352 2.0089 0.2835 -3.7254 F1(:,:,127) = 2.3883 -0.1366 -0.5249 2.7028 -1.0564 -0.7592 2.1714 0.5727 -3.5987 F1(:,:,128) = 2.4149 0.0075 -0.4074 2.7874 -0.8824 -0.6699 2.3124 0.8626 -3.4498 F1(:,:,129) = 2.4283 0.1466 -0.2817 2.8585 -0.7094 -0.5679 2.4309 1.1511 -3.2798 F1(:,:,130) = 2.4285 0.2796 -0.1489 2.9156 -0.5385 -0.4541 2.5261 1.4359 -3.0901 F1(:,:,131) = 2.4153 0.4054 -0.0098 2.9583 -0.3710 -0.3293 2.5971 1.7150 -2.8821 F1(:,:,132) = 2.3889 0.5232 0.1343 2.9861 -0.2083 -0.1944 2.6435 1.9862 -2.6573 F1(:,:,133) = 2.3494 0.6318 0.2825 2.9988 -0.0517 -0.0505 2.6647 2.2472 -2.4175 F1(:,:,134) = 2.2971 0.7306 0.4335 2.9964 0.0978 0.1014 2.6606 2.4963 -2.1644 F1(:,:,135) = 2.2325 0.8188 0.5863 2.9788 0.2388 0.2601 2.6313 2.7314 -1.8999 F1(:,:,136) = 2.1560 0.8957 0.7397 2.9462 0.3705 0.4244 2.5769 2.9509 -1.6261 F1(:,:,137) = 2.0682 0.9608 0.8926 2.8988 0.4918 0.5930 2.4980 3.1531 -1.3450 F1(:,:,138) = 1.9699 1.0137 1.0438 2.8372 0.6019 0.7647 2.3953 3.3365 -1.0588 F1(:,:,139) = 1.8617 1.0538 1.1922 2.7616 0.6999 0.9383 2.2694 3.4999 -0.7695 F1(:,:,140) = 1.7444 1.0810 1.3366 2.6728 0.7851 1.1123 2.1213 3.6418 -0.4795 F1(:,:,141) = 1.6190 1.0949 1.4758 2.5712 0.8567 1.2854 1.9521 3.7611 -0.1910 F1(:,:,142) = 1.4864 1.0954 1.6090 2.4578 0.9142 1.4564 1.7630 3.8569 0.0939 F1(:,:,143) = 1.3476 1.0825 1.7349 2.3333 0.9571 1.6238 1.5555 3.9285 0.3730 F1(:,:,144) = 1.2036 1.0564 1.8528 2.1987 0.9853 1.7866 1.3312 3.9754 0.6443 F1(:,:,145) = 1.0556 1.0173 1.9617 2.0550 0.9984 1.9434 1.0917 3.9973 0.9056 F1(:,:,146) = 0.9046 0.9654 2.0609 1.9034 0.9964 2.0931 0.8389 3.9941 1.1551 F1(:,:,147) = 0.7517 0.9012 2.1495 1.7449 0.9794 2.2345 0.5748 3.9657 1.3909 F1(:,:,148) = 0.5983 0.8252 2.2269 1.5807 0.9474 2.3667 0.3012 3.9123 1.6111 F1(:,:,149) = 0.4453 0.7378 2.2925 1.4122 0.9006 2.4884 0.0203 3.8343 1.8140 F1(:,:,150) = 0.2941 0.6398 2.3457 1.2406 0.8394 2.5988 -0.2657 3.7323 1.9980 F1(:,:,151) = 0.1457 0.5319 2.3861 1.0671 0.7642 2.6971 -0.5548 3.6070 2.1618 F1(:,:,152) = 0.0013 0.4149 2.4136 0.8932 0.6757 2.7825 -0.8447 3.4595 2.3042 F1(:,:,153) = -0.1381 0.2897 2.4278 0.7200 0.5745 2.8545 -1.1333 3.2908 2.4241 F1(:,:,154) = -0.2715 0.1572 2.4287 0.5490 0.4614 2.9124 -1.4184 3.1023 2.5207 F1(:,:,155) = -0.3978 0.0186 2.4164 0.3813 0.3372 2.9560 -1.6979 2.8954 2.5933 F1(:,:,156) = -0.5161 -0.1253 2.3908 0.2183 0.2030 2.9847 -1.9696 2.6716 2.6412 F1(:,:,157) = -0.6253 -0.2732 2.3521 0.0612 0.0596 2.9984 -2.2313 2.4326 2.6640 F1(:,:,158) = -0.7248 -0.4241 2.3007 -0.0887 -0.0918 2.9969 -2.4811 2.1803 2.6615 F1(:,:,159) = -0.8136 -0.5768 2.2368 -0.2303 -0.2501 2.9802 -2.7172 1.9165 2.6337 F1(:,:,160) = -0.8912 -0.7302 2.1610 -0.3626 -0.4141 2.9485 -2.9377 1.6432 2.5809 F1(:,:,161) = -0.9571 -0.8832 2.0739 -0.4846 -0.5825 2.9021 -3.1410 1.3625 2.5035 F1(:,:,162) = -1.0107 -1.0345 1.9762 -0.5954 -0.7541 2.8413 -3.3256 1.0766 2.4022 F1(:,:,163) = -1.0516 -1.1831 1.8686 -0.6942 -0.9275 2.7666 -3.4903 0.7875 2.2777 F1(:,:,164) = -1.0796 -1.3277 1.7519 -0.7801 -1.1015 2.6786 -3.6335 0.4974 2.1310 F1(:,:,165) = -1.0943 -1.4673 1.6270 -0.8526 -1.2747 2.5778 -3.7543 0.2088 1.9630 F1(:,:,166) = -1.0956 -1.6009 1.4948 -0.9109 -1.4458 2.4651 -3.8516 -0.0764 1.7751 F1(:,:,167) = -1.0836 -1.7273 1.3563 -0.9548 -1.6136 2.3412 -3.9247 -0.3559 1.5687 F1(:,:,168) = -1.0583 -1.8457 1.2126 -0.9839 -1.7766 2.2072 -3.9731 -0.6277 1.3454 F1(:,:,169) = -1.0200 -1.9552 1.0648 -0.9979 -1.9338 2.0641 -3.9965 -0.8897 1.1068 F1(:,:,170) = -0.9689 -2.0550 0.9140 -0.9969 -2.0840 1.9129 -3.9948 -1.1400 0.8549 F1(:,:,171) = -0.9055 -2.1443 0.7612 -0.9808 -2.2260 1.7548 -3.9680 -1.3767 0.5913 F1(:,:,172) = -0.8301 -2.2224 0.6078 -0.9497 -2.3587 1.5910 -3.9162 -1.5979 0.3183 F1(:,:,173) = -0.7435 -2.2887 0.4548 -0.9038 -2.4811 1.4227 -3.8397 -1.8018 0.0379 F1(:,:,174) = -0.6461 -2.3427 0.3034 -0.8435 -2.5922 1.2513 -3.7392 -1.9871 -0.2479 F1(:,:,175) = -0.5388 -2.3839 0.1548 -0.7692 -2.6913 1.0779 -3.6153 -2.1521 -0.5368 F1(:,:,176) = -0.4223 -2.4122 0.0101 -0.6815 -2.7775 0.9039 -3.4691 -2.2959 -0.8268 F1(:,:,177) = -0.2976 -2.4272 -0.1296 -0.5810 -2.8503 0.7307 -3.3017 -2.4172 -1.1155 F1(:,:,178) = -0.1656 -2.4290 -0.2634 -0.4687 -2.9092 0.5595 -3.1144 -2.5153 -1.4009 F1(:,:,179) = -0.0273 -2.4175 -0.3902 -0.3452 -2.9536 0.3915 -2.9086 -2.5894 -1.6808 F1(:,:,180) = 0.1163 -2.3927 -0.5090 -0.2115 -2.9833 0.2282 -2.6858 -2.6388 -1.9530 F1(:,:,181) = 0.2640 -2.3548 -0.6188 -0.0687 -2.9979 0.0708 -2.4478 -2.6631 -2.2154 F1(:,:,182) = 0.4147 -2.3041 -0.7188 0.0823 -2.9973 -0.0796 -2.1962 -2.6622 -2.4660 F1(:,:,183) = 0.5674 -2.2410 -0.8084 0.2402 -2.9816 -0.2217 -1.9331 -2.6360 -2.7029 F1(:,:,184) = 0.7208 -2.1659 -0.8867 0.4038 -2.9508 -0.3546 -1.6603 -2.5847 -2.9244 F1(:,:,185) = 0.8738 -2.0795 -0.9533 0.5720 -2.9053 -0.4773 -1.3800 -2.5088 -3.1288 F1(:,:,186) = 1.0252 -1.9825 -1.0077 0.7434 -2.8454 -0.5888 -1.0943 -2.4090 -3.3147 F1(:,:,187) = 1.1740 -1.8755 -1.0494 0.9168 -2.7716 -0.6883 -0.8054 -2.2859 -3.4805 F1(:,:,188) = 1.3189 -1.7593 -1.0782 1.0908 -2.6843 -0.7751 -0.5154 -2.1405 -3.6252 F1(:,:,189) = 1.4588 -1.6349 -1.0937 1.2641 -2.5843 -0.8484 -0.2266 -1.9739 -3.7473 F1(:,:,190) = 1.5928 -1.5031 -1.0959 1.4353 -2.4723 -0.9076 0.0589 -1.7872 -3.8461 F1(:,:,191) = 1.7197 -1.3650 -1.0847 1.6033 -2.3492 -0.9524 0.3388 -1.5819 -3.9207 F1(:,:,192) = 1.8386 -1.2216 -1.0602 1.7667 -2.2158 -0.9824 0.6111 -1.3596 -3.9707 F1(:,:,193) = 1.9486 -1.0740 -1.0226 1.9242 -2.0732 -0.9974 0.8737 -1.1219 -3.9957 F1(:,:,194) = 2.0490 -0.9233 -0.9724 2.0749 -1.9225 -0.9973 1.1248 -0.8708 -3.9955 F1(:,:,195) = 2.1389 -0.7707 -0.9097 2.2174 -1.7648 -0.9821 1.3623 -0.6079 -3.9702 F1(:,:,196) = 2.2177 -0.6173 -0.8350 2.3506 -1.6013 -0.9519 1.5844 -0.3355 -3.9199 F1(:,:,197) = 2.2847 -0.4643 -0.7490 2.4737 -1.4333 -0.9069 1.7894 -0.0554 -3.8449 F1(:,:,198) = 2.3395 -0.3128 -0.6523 2.5855 -1.2620 -0.8475 1.9758 0.2300 -3.7458 F1(:,:,199) = 2.3816 -0.1640 -0.5456 2.6853 -1.0887 -0.7740 2.1422 0.5188 -3.6234 F1(:,:,200) = 2.4107 -0.0190 -0.4297 2.7724 -0.9147 -0.6872 2.2874 0.8088 -3.4786
odefun2 = @(t,R)fun2(t,R,R1,R2);
[T,F2] = ode45(odefun2,tspan,R2);
% [T,F2] = ode45(odefun2,tspan,R2, OPTs);
F2 = reshape(F2.',3,3,[])
F2 =
F2(:,:,1) = 1 5 3 3 1 2 2 6 4 F2(:,:,2) = 1.3965 5.0827 2.6863 3.1443 0.9410 1.7967 2.4943 6.0777 3.5834 F2(:,:,3) = 1.7798 5.1295 2.3496 3.2748 0.8647 1.5899 2.9697 6.1093 3.1396 F2(:,:,4) = 2.1472 5.1399 1.9927 3.3906 0.7719 1.3812 3.4227 6.0947 2.6720 F2(:,:,5) = 2.4959 5.1140 1.6181 3.4910 0.6630 1.1721 3.8499 6.0340 2.1842 F2(:,:,6) = 2.8233 5.0520 1.2287 3.5750 0.5391 0.9641 4.2480 5.9277 1.6797 F2(:,:,7) = 3.1267 4.9542 0.8275 3.6420 0.4010 0.7590 4.6139 5.7766 1.1626 F2(:,:,8) = 3.4038 4.8214 0.4176 3.6916 0.2498 0.5582 4.9448 5.5816 0.6368 F2(:,:,9) = 3.6525 4.6546 0.0020 3.7232 0.0866 0.3634 5.2381 5.3442 0.1062 F2(:,:,10) = 3.8710 4.4549 -0.4161 3.7366 -0.0874 0.1759 5.4916 5.0663 -0.4252 F2(:,:,11) = 4.0576 4.2240 -0.8336 3.7319 -0.2709 -0.0028 5.7035 4.7500 -0.9535 F2(:,:,12) = 4.2110 3.9637 -1.2473 3.7090 -0.4624 -0.1714 5.8723 4.3978 -1.4745 F2(:,:,13) = 4.3302 3.6759 -1.6542 3.6682 -0.6605 -0.3287 5.9968 4.0124 -1.9845 F2(:,:,14) = 4.4142 3.3629 -2.0513 3.6098 -0.8637 -0.4734 6.0762 3.5966 -2.4796 F2(:,:,15) = 4.4623 3.0270 -2.4353 3.5341 -1.0704 -0.6045 6.1095 3.1536 -2.9559 F2(:,:,16) = 4.4739 2.6707 -2.8033 3.4418 -1.2791 -0.7209 6.0964 2.6867 -3.4097 F2(:,:,17) = 4.4491 2.2967 -3.1525 3.3334 -1.4882 -0.8217 6.0371 2.1995 -3.8376 F2(:,:,18) = 4.3879 1.9078 -3.4802 3.2099 -1.6961 -0.9060 5.9319 1.6957 -4.2362 F2(:,:,19) = 4.2909 1.5069 -3.7840 3.0721 -1.9013 -0.9734 5.7817 1.1789 -4.6027 F2(:,:,20) = 4.1589 1.0971 -4.0618 2.9212 -2.1021 -1.0233 5.5877 0.6532 -4.9344 F2(:,:,21) = 3.9930 0.6816 -4.3114 2.7583 -2.2972 -1.0555 5.3516 0.1226 -5.2289 F2(:,:,22) = 3.7945 0.2634 -4.5311 2.5846 -2.4850 -1.0696 5.0750 -0.4090 -5.4840 F2(:,:,23) = 3.5647 -0.1544 -4.7191 2.4014 -2.6642 -1.0656 4.7601 -0.9376 -5.6977 F2(:,:,24) = 3.3055 -0.5684 -4.8738 2.2102 -2.8332 -1.0434 4.4092 -1.4590 -5.8682 F2(:,:,25) = 3.0186 -0.9754 -4.9940 2.0123 -2.9908 -1.0032 4.0248 -1.9693 -5.9941 F2(:,:,26) = 2.7064 -1.3725 -5.0789 1.8094 -3.1359 -0.9452 3.6099 -2.4645 -6.0745 F2(:,:,27) = 2.3710 -1.7566 -5.1277 1.6028 -3.2672 -0.8699 3.1677 -2.9411 -6.1087 F2(:,:,28) = 2.0152 -2.1250 -5.1402 1.3941 -3.3839 -0.7780 2.7014 -3.3954 -6.0967 F2(:,:,29) = 1.6416 -2.4747 -5.1163 1.1850 -3.4851 -0.6701 2.2147 -3.8240 -6.0387 F2(:,:,30) = 1.2531 -2.8034 -5.0565 0.9769 -3.5701 -0.5470 1.7112 -4.2239 -5.9351 F2(:,:,31) = 0.8525 -3.1084 -4.9609 0.7716 -3.6382 -0.4098 1.1947 -4.5920 -5.7867 F2(:,:,32) = 0.4429 -3.3874 -4.8303 0.5704 -3.6889 -0.2593 0.6692 -4.9253 -5.5945 F2(:,:,33) = 0.0276 -3.6380 -4.6656 0.3752 -3.7217 -0.0968 0.1387 -5.2211 -5.3598 F2(:,:,34) = -0.3905 -3.8585 -4.4680 0.1872 -3.7363 0.0765 -0.3927 -5.4772 -5.0845 F2(:,:,35) = -0.8080 -4.0471 -4.2391 0.0079 -3.7327 0.2594 -0.9212 -5.6917 -4.7705 F2(:,:,36) = -1.2220 -4.2025 -3.9804 -0.1613 -3.7109 0.4504 -1.4427 -5.8631 -4.4204 F2(:,:,37) = -1.6293 -4.3236 -3.6942 -0.3192 -3.6711 0.6481 -1.9533 -5.9901 -4.0368 F2(:,:,38) = -2.0269 -4.4096 -3.3827 -0.4647 -3.6137 0.8510 -2.4492 -6.0720 -3.6228 F2(:,:,39) = -2.4117 -4.4598 -3.0481 -0.5966 -3.5390 1.0576 -2.9267 -6.1080 -3.1813 F2(:,:,40) = -2.7808 -4.4737 -2.6929 -0.7140 -3.4477 1.2663 -3.3821 -6.0979 -2.7158 F2(:,:,41) = -3.1313 -4.4513 -2.3199 -0.8158 -3.3404 1.4754 -3.8118 -6.0415 -2.2298 F2(:,:,42) = -3.4606 -4.3924 -1.9319 -0.9012 -3.2178 1.6834 -4.2124 -5.9393 -1.7269 F2(:,:,43) = -3.7660 -4.2978 -1.5318 -0.9697 -3.0809 1.8888 -4.5811 -5.7920 -1.2109 F2(:,:,44) = -4.0454 -4.1679 -1.1225 -1.0207 -2.9308 2.0899 -4.9150 -5.6007 -0.6858 F2(:,:,45) = -4.2967 -4.0040 -0.7073 -1.0539 -2.7686 2.2853 -5.2117 -5.3671 -0.1554 F2(:,:,46) = -4.5182 -3.8074 -0.2893 -1.0691 -2.5955 2.4736 -5.4691 -5.0929 0.3761 F2(:,:,47) = -4.7081 -3.5795 0.1286 -1.0662 -2.4129 2.6533 -5.6853 -4.7803 0.9050 F2(:,:,48) = -4.8649 -3.3220 0.5429 -1.0451 -2.2221 2.8230 -5.8585 -4.4315 1.4271 F2(:,:,49) = -4.9874 -3.0368 0.9506 -1.0060 -2.0246 2.9814 -5.9873 -4.0491 1.9382 F2(:,:,50) = -5.0745 -2.7261 1.3484 -0.9492 -1.8219 3.1273 -6.0707 -3.6361 2.4346 F2(:,:,51) = -5.1257 -2.3922 1.7335 -0.8750 -1.6155 3.2595 -6.1079 -3.1955 2.9124 F2(:,:,52) = -5.1404 -2.0376 2.1028 -0.7841 -1.4070 3.3771 -6.0988 -2.7307 3.3681 F2(:,:,53) = -5.1187 -1.6650 2.4537 -0.6771 -1.1979 3.4793 -6.0434 -2.2451 3.7983 F2(:,:,54) = -5.0609 -1.2773 2.7836 -0.5549 -0.9898 3.5652 -5.9424 -1.7426 4.1998 F2(:,:,55) = -4.9674 -0.8775 3.0900 -0.4185 -0.7842 3.6343 -5.7967 -1.2269 4.5698 F2(:,:,56) = -4.8390 -0.4683 3.3706 -0.2689 -0.5828 3.6861 -5.6071 -0.7018 4.9053 F2(:,:,57) = -4.6764 -0.0532 3.6232 -0.1071 -0.3870 3.7200 -5.3750 -0.1714 5.2037 F2(:,:,58) = -4.4809 0.3648 3.8457 0.0656 -0.1985 3.7359 -5.1023 0.3602 5.4625 F2(:,:,59) = -4.2539 0.7825 4.0364 0.2479 -0.0186 3.7334 -4.7908 0.8890 5.6798 F2(:,:,60) = -3.9972 1.1968 4.1940 0.4385 0.1512 3.7128 -4.4429 1.4110 5.8539 F2(:,:,61) = -3.7126 1.6045 4.3171 0.6358 0.3098 3.6740 -4.0613 1.9222 5.9836 F2(:,:,62) = -3.4024 2.0026 4.4051 0.8384 0.4560 3.6176 -3.6490 2.4190 6.0680 F2(:,:,63) = -3.0692 2.3882 4.4573 1.0448 0.5887 3.5440 -3.2091 2.8976 6.1067 F2(:,:,64) = -2.7152 2.7583 4.4735 1.2533 0.7069 3.4536 -2.7450 3.3543 6.0993 F2(:,:,65) = -2.3432 3.1101 4.4532 1.4625 0.8097 3.3472 -2.2600 3.7857 6.0458 F2(:,:,66) = -1.9560 3.4408 4.3967 1.6707 0.8963 3.2256 -1.7581 4.1884 5.9465 F2(:,:,67) = -1.5565 3.7478 4.3044 1.8763 0.9659 3.0896 -1.2428 4.5592 5.8020 F2(:,:,68) = -1.1478 4.0289 4.1768 2.0777 1.0180 2.9404 -0.7182 4.8954 5.6136 F2(:,:,69) = -0.7330 4.2820 4.0150 2.2735 1.0524 2.7789 -0.1881 5.1944 5.3825 F2(:,:,70) = -0.3150 4.5052 3.8203 2.4622 1.0686 2.6064 0.3434 5.4542 5.1107 F2(:,:,71) = 0.1028 4.6969 3.5942 2.6423 1.0667 2.4244 0.8724 5.6727 4.8003 F2(:,:,72) = 0.5174 4.8558 3.3384 2.8127 1.0467 2.2341 1.3949 5.8486 4.4536 F2(:,:,73) = 0.9256 4.9805 3.0549 2.9719 1.0088 2.0369 1.9070 5.9802 4.0733 F2(:,:,74) = 1.3243 5.0699 2.7457 3.1186 0.9531 1.8345 2.4045 6.0665 3.6621 F2(:,:,75) = 1.7102 5.1234 2.4132 3.2518 0.8800 1.6282 2.8836 6.1068 3.2232 F2(:,:,76) = 2.0806 5.1405 2.0599 3.3703 0.7901 1.4198 3.3408 6.1006 2.7598 F2(:,:,77) = 2.4327 5.1211 1.6884 3.4734 0.6841 1.2107 3.7726 6.0481 2.2755 F2(:,:,78) = 2.7638 5.0654 1.3016 3.5603 0.5628 1.0025 4.1759 5.9498 1.7739 F2(:,:,79) = 3.0716 4.9739 0.9024 3.6304 0.4272 0.7968 4.5476 5.8066 1.2589 F2(:,:,80) = 3.3537 4.8475 0.4938 3.6832 0.2783 0.5952 4.8851 5.6195 0.7344 F2(:,:,81) = 3.6081 4.6870 0.0789 3.7182 0.1172 0.3990 5.1859 5.3900 0.2042 F2(:,:,82) = 3.8326 4.4935 -0.3391 3.7352 -0.0548 0.2100 5.4473 5.1198 -0.3276 F2(:,:,83) = 4.0255 4.2685 -0.7570 3.7340 -0.2366 0.0294 5.6674 4.8107 -0.8567 F2(:,:,84) = 4.1853 4.0137 -1.1716 3.7145 -0.4266 -0.1411 5.8444 4.4652 -1.3793 F2(:,:,85) = 4.3106 3.7309 -1.5798 3.6770 -0.6235 -0.3005 5.9770 4.0857 -1.8913 F2(:,:,86) = 4.4008 3.4223 -1.9785 3.6216 -0.8258 -0.4474 6.0642 3.6752 -2.3890 F2(:,:,87) = 4.4550 3.0902 -2.3648 3.5489 -1.0320 -0.5809 6.1054 3.2368 -2.8686 F2(:,:,88) = 4.4732 2.7374 -2.7358 3.4595 -1.2404 -0.6999 6.1006 2.7740 -3.3266 F2(:,:,89) = 4.4551 2.3664 -3.0887 3.3541 -1.4496 -0.8037 6.0499 2.2903 -3.7595 F2(:,:,90) = 4.4008 1.9801 -3.4207 3.2333 -1.6579 -0.8912 5.9533 1.7893 -4.1640 F2(:,:,91) = 4.3107 1.5813 -3.7294 3.0982 -1.8637 -0.9619 5.8117 1.2747 -4.5370 F2(:,:,92) = 4.1853 1.1731 -4.0123 2.9498 -2.0654 -1.0152 5.6260 0.7505 -4.8755 F2(:,:,93) = 4.0257 0.7585 -4.2672 2.7890 -2.2616 -1.0507 5.3977 0.2207 -5.1770 F2(:,:,94) = 3.8330 0.3408 -4.4923 2.6173 -2.4508 -1.0680 5.1284 -0.3108 -5.4392 F2(:,:,95) = 3.6088 -0.0771 -4.6859 2.4358 -2.6315 -1.0673 4.8203 -0.8399 -5.6602 F2(:,:,96) = 3.3548 -0.4918 -4.8466 2.2460 -2.8024 -1.0483 4.4758 -1.3628 -5.8385 F2(:,:,97) = 3.0729 -0.9005 -4.9734 2.0492 -2.9622 -1.0114 4.0974 -1.8755 -5.9729 F2(:,:,98) = 2.7652 -1.2999 -5.0651 1.8470 -3.1098 -0.9568 3.6879 -2.3741 -6.0621 F2(:,:,99) = 2.4341 -1.6869 -5.1209 1.6409 -3.2439 -0.8848 3.2506 -2.8547 -6.1053 F2(:,:,100) = 2.0820 -2.0584 -5.1404 1.4326 -3.3634 -0.7960 2.7887 -3.3134 -6.1022 F2(:,:,101) = 1.7116 -2.4117 -5.1233 1.2235 -3.4676 -0.6911 2.3057 -3.7469 -6.0526 F2(:,:,102) = 1.3257 -2.7441 -5.0698 1.0153 -3.5555 -0.5707 1.8052 -4.1520 -5.9572 F2(:,:,103) = 0.9272 -3.0533 -4.9805 0.8094 -3.6265 -0.4359 1.2909 -4.5256 -5.8165 F2(:,:,104) = 0.5192 -3.3369 -4.8560 0.6075 -3.6803 -0.2878 0.7669 -4.8651 -5.6320 F2(:,:,105) = 0.1047 -3.5928 -4.6975 0.4111 -3.7163 -0.1274 0.2371 -5.1679 -5.4050 F2(:,:,106) = -0.3133 -3.8192 -4.5060 0.2215 -3.7345 0.0440 -0.2947 -5.4318 -5.1371 F2(:,:,107) = -0.7314 -4.0142 -4.2829 0.0404 -3.7344 0.2252 -0.8243 -5.6547 -4.8304 F2(:,:,108) = -1.1463 -4.1762 -4.0299 -0.1309 -3.7161 0.4148 -1.3475 -5.8346 -4.4871 F2(:,:,109) = -1.5550 -4.3039 -3.7489 -0.2911 -3.6797 0.6113 -1.8603 -5.9701 -4.1097 F2(:,:,110) = -1.9544 -4.3963 -3.4419 -0.4388 -3.6255 0.8133 -2.3590 -6.0602 -3.7012 F2(:,:,111) = -2.3415 -4.4528 -3.1113 -0.5731 -3.5539 1.0192 -2.8398 -6.1043 -3.2645 F2(:,:,112) = -2.7134 -4.4730 -2.7596 -0.6930 -3.4654 1.2276 -3.2991 -6.1022 -2.8031 F2(:,:,113) = -3.0674 -4.4570 -2.3896 -0.7976 -3.3609 1.4367 -3.7334 -6.0539 -2.3205 F2(:,:,114) = -3.4007 -4.4048 -2.0042 -0.8861 -3.2411 1.6451 -4.1397 -5.9601 -1.8205 F2(:,:,115) = -3.7109 -4.3169 -1.6060 -0.9579 -3.1068 1.8511 -4.5147 -5.8212 -1.3065 F2(:,:,116) = -3.9955 -4.1937 -1.1982 -1.0123 -2.9591 2.0532 -4.8555 -5.6383 -0.7828 F2(:,:,117) = -4.2523 -4.0363 -0.7840 -1.0489 -2.7992 2.2498 -5.1594 -5.4126 -0.2532 F2(:,:,118) = -4.4793 -3.8456 -0.3664 -1.0675 -2.6281 2.4394 -5.4242 -5.1459 0.2783 F2(:,:,119) = -4.6749 -3.6233 0.0515 -1.0678 -2.4472 2.6206 -5.6478 -4.8401 0.8076 F2(:,:,120) = -4.8375 -3.3711 0.4665 -1.0499 -2.2578 2.7921 -5.8286 -4.4977 1.3309 F2(:,:,121) = -4.9662 -3.0908 0.8754 -1.0140 -2.0615 2.9526 -5.9654 -4.1213 1.8441 F2(:,:,122) = -5.0599 -2.7846 1.2753 -0.9605 -1.8596 3.1009 -6.0572 -3.7137 2.3435 F2(:,:,123) = -5.1180 -2.4548 1.6632 -0.8895 -1.6537 3.2358 -6.1032 -3.2780 2.8253 F2(:,:,124) = -5.1397 -2.1039 2.0358 -0.8017 -1.4454 3.3563 -6.1030 -2.8175 3.2856 F2(:,:,125) = -5.1250 -1.7346 2.3904 -0.6978 -1.2363 3.4615 -6.0565 -2.3357 3.7209 F2(:,:,126) = -5.0739 -1.3497 2.7242 -0.5784 -1.0280 3.5504 -5.9640 -1.8362 4.1278 F2(:,:,127) = -4.9869 -0.9520 3.0349 -0.4446 -0.8220 3.6226 -5.8263 -1.3228 4.5035 F2(:,:,128) = -4.8645 -0.5445 3.3201 -0.2972 -0.6198 3.6774 -5.6444 -0.7993 4.8450 F2(:,:,129) = -4.7080 -0.1303 3.5776 -0.1375 -0.4231 3.7145 -5.4198 -0.2698 5.1500 F2(:,:,130) = -4.5184 0.2874 3.8058 0.0332 -0.2331 3.7337 -5.1544 0.2618 5.4162 F2(:,:,131) = -4.2972 0.7055 4.0027 0.2139 -0.0514 3.7347 -4.8500 0.7917 5.6416 F2(:,:,132) = -4.0460 1.1209 4.1669 0.4030 0.1206 3.7176 -4.5089 1.3155 5.8243 F2(:,:,133) = -3.7667 1.5301 4.2968 0.5991 0.2815 3.6824 -4.1336 1.8292 5.9628 F2(:,:,134) = -3.4613 1.9302 4.3916 0.8008 0.4301 3.6293 -3.7270 2.3289 6.0559 F2(:,:,135) = -3.1322 2.3181 4.4504 1.0065 0.5653 3.5588 -3.2921 2.8108 6.1029 F2(:,:,136) = -2.7818 2.6910 4.4728 1.2147 0.6861 3.4714 -2.8322 3.2715 6.1036 F2(:,:,137) = -2.4129 3.0460 4.4589 1.4238 0.7916 3.3677 -2.3507 3.7074 6.0581 F2(:,:,138) = -2.0282 3.3806 4.4088 1.6323 0.8810 3.2488 -1.8516 4.1153 5.9669 F2(:,:,139) = -1.6308 3.6922 4.3230 1.8384 0.9538 3.1154 -1.3385 4.4922 5.8307 F2(:,:,140) = -1.2235 3.9785 4.2020 2.0408 1.0093 2.9685 -0.8152 4.8352 5.6504 F2(:,:,141) = -0.8095 4.2371 4.0466 2.2378 1.0471 2.8092 -0.2858 5.1416 5.4274 F2(:,:,142) = -0.3920 4.4661 3.8581 2.4280 1.0668 2.6388 0.2457 5.4089 5.1632 F2(:,:,143) = 0.0259 4.6637 3.6378 2.6097 1.0682 2.4585 0.7753 5.6351 4.8599 F2(:,:,144) = 0.4411 4.8284 3.3873 2.7818 1.0515 2.2696 1.2990 5.8186 4.5197 F2(:,:,145) = 0.8505 4.9591 3.1086 2.9430 1.0167 2.0737 1.8128 5.9580 4.1452 F2(:,:,146) = 1.2509 5.0549 2.8040 3.0920 0.9641 1.8721 2.3130 6.0525 3.7394 F2(:,:,147) = 1.6394 5.1150 2.4756 3.2277 0.8942 1.6665 2.7958 6.1012 3.3054 F2(:,:,148) = 2.0131 5.1390 2.1259 3.3492 0.8075 1.4583 3.2576 6.1039 2.8463 F2(:,:,149) = 2.3690 5.1266 1.7577 3.4553 0.7045 1.2492 3.6947 6.0603 2.3657 F2(:,:,150) = 2.7043 5.0779 1.3736 3.5454 0.5861 1.0407 4.1036 5.9708 1.8672 F2(:,:,151) = 3.0165 4.9931 0.9766 3.6186 0.4531 0.8345 4.4813 5.8359 1.3546 F2(:,:,152) = 3.3033 4.8730 0.5697 3.6745 0.3066 0.6321 4.8250 5.6567 0.8317 F2(:,:,153) = 3.5625 4.7184 0.1559 3.7127 0.1477 0.4350 5.1322 5.4347 0.3025 F2(:,:,154) = 3.7923 4.5308 -0.2615 3.7328 -0.0225 0.2447 5.4006 5.1716 -0.2290 F2(:,:,155) = 3.9911 4.3114 -0.6797 3.7349 -0.2026 0.0625 5.6283 4.8695 -0.7589 F2(:,:,156) = 4.1573 4.0620 -1.0953 3.7189 -0.3912 -0.1101 5.8137 4.5305 -1.2832 F2(:,:,157) = 4.2895 3.7843 -1.5051 3.6849 -0.5870 -0.2718 5.9551 4.1573 -1.7978 F2(:,:,158) = 4.3866 3.4806 -1.9060 3.6329 -0.7884 -0.4213 6.0512 3.7526 -2.2986 F2(:,:,159) = 4.4477 3.1529 -2.2948 3.5636 -0.9938 -0.5574 6.1013 3.3194 -2.7819 F2(:,:,160) = 4.4726 2.8039 -2.6687 3.4772 -1.2019 -0.6791 6.1050 2.8611 -3.2439 F2(:,:,161) = 4.4609 2.4361 -3.0248 3.3746 -1.4110 -0.7856 6.0623 2.3809 -3.6814 F2(:,:,162) = 4.4129 2.0523 -3.3606 3.2565 -1.6195 -0.8760 5.9737 1.8827 -4.0910 F2(:,:,163) = 4.3290 1.6555 -3.6735 3.1239 -1.8258 -0.9497 5.8400 1.3703 -4.4697 F2(:,:,164) = 4.2101 1.2488 -3.9613 2.9778 -2.0284 -1.0062 5.6624 0.8477 -4.8147 F2(:,:,165) = 4.0568 0.8351 -4.2217 2.8192 -2.2258 -1.0451 5.4419 0.3185 -5.1234 F2(:,:,166) = 3.8703 0.4176 -4.4527 2.6495 -2.4165 -1.0659 5.1802 -0.2131 -5.3933 F2(:,:,167) = 3.6520 -0.0004 -4.6524 2.4697 -2.5988 -1.0686 4.8793 -0.7430 -5.6223 F2(:,:,168) = 3.4034 -0.4158 -4.8192 2.2814 -2.7716 -1.0530 4.5414 -1.2671 -5.8086 F2(:,:,169) = 3.1265 -0.8256 -4.9520 2.0859 -2.9334 -1.0193 4.1691 -1.7817 -5.9507 F2(:,:,170) = 2.8233 -1.2266 -5.0499 1.8846 -3.0831 -0.9678 3.7651 -2.2827 -6.0478 F2(:,:,171) = 2.4963 -1.6158 -5.1120 1.6792 -3.2196 -0.8989 3.3326 -2.7665 -6.0991 F2(:,:,172) = 2.1479 -1.9903 -5.1382 1.4712 -3.3419 -0.8131 2.8750 -3.2295 -6.1045 F2(:,:,173) = 1.7806 -2.3474 -5.1280 1.2621 -3.4490 -0.7111 2.3956 -3.6682 -6.0638 F2(:,:,174) = 1.3974 -2.6841 -5.0815 1.0535 -3.5401 -0.5936 1.8981 -4.0790 -5.9771 F2(:,:,175) = 1.0012 -2.9979 -4.9991 0.8471 -3.6145 -0.4616 1.3862 -4.4589 -5.8451 F2(:,:,176) = 0.5948 -3.2864 -4.8812 0.6444 -3.6715 -0.3159 0.8639 -4.8049 -5.6688 F2(:,:,177) = 0.1814 -3.5474 -4.7288 0.4469 -3.7108 -0.1577 0.3351 -5.1143 -5.4494 F2(:,:,178) = -0.2359 -3.7789 -4.5431 0.2562 -3.7320 0.0118 -0.1964 -5.3851 -5.1887 F2(:,:,179) = -0.6539 -3.9794 -4.3255 0.0736 -3.7352 0.1913 -0.7263 -5.6151 -4.8888 F2(:,:,180) = -1.0696 -4.1475 -4.0779 -0.0996 -3.7202 0.3794 -1.2508 -5.8029 -4.5520 F2(:,:,181) = -1.4799 -4.2818 -3.8019 -0.2620 -3.6872 0.5748 -1.7661 -5.9469 -4.1808 F2(:,:,182) = -1.8815 -4.3811 -3.4996 -0.4123 -3.6364 0.7759 -2.2681 -6.0460 -3.7779 F2(:,:,183) = -2.2712 -4.4447 -3.1734 -0.5493 -3.5681 0.9812 -2.7526 -6.0991 -3.3464 F2(:,:,184) = -2.6462 -4.4719 -2.8257 -0.6720 -3.4829 1.1891 -3.2162 -6.1059 -2.8896 F2(:,:,185) = -3.0035 -4.4626 -2.4591 -0.7795 -3.3813 1.3982 -3.6553 -6.0662 -2.4109 F2(:,:,186) = -3.3406 -4.4169 -2.0763 -0.8709 -3.2642 1.6067 -4.0666 -5.9805 -1.9138 F2(:,:,187) = -3.6549 -4.3351 -1.6802 -0.9456 -3.1324 1.8132 -4.4472 -5.8494 -1.4022 F2(:,:,188) = -3.9441 -4.2182 -1.2740 -1.0031 -2.9871 2.0160 -4.7942 -5.6742 -0.8800 F2(:,:,189) = -4.2062 -4.0669 -0.8608 -1.0430 -2.8293 2.2137 -5.1051 -5.4563 -0.3512 F2(:,:,190) = -4.4390 -3.8824 -0.4434 -1.0650 -2.6601 2.4048 -5.3774 -5.1971 0.1803 F2(:,:,191) = -4.6408 -3.6660 -0.0253 -1.0688 -2.4810 2.5878 -5.6091 -4.8986 0.7105 F2(:,:,192) = -4.8098 -3.4193 0.3905 -1.0544 -2.2931 2.7612 -5.7982 -4.5629 1.2352 F2(:,:,193) = -4.9448 -3.1441 0.8007 -1.0218 -2.0980 2.9238 -5.9432 -4.1927 1.7504 F2(:,:,194) = -5.0448 -2.8426 1.2022 -0.9714 -1.8971 3.0743 -6.0431 -3.7907 2.2524 F2(:,:,195) = -5.1091 -2.5169 1.5922 -0.9035 -1.6919 3.2116 -6.0972 -3.3599 2.7372 F2(:,:,196) = -5.1373 -2.1697 1.9676 -0.8187 -1.4840 3.3347 -6.1052 -2.9037 3.2014 F2(:,:,197) = -5.1293 -1.8037 2.3256 -0.7177 -1.2750 3.4427 -6.0671 -2.4256 3.6415 F2(:,:,198) = -5.0849 -1.4214 2.6635 -0.6011 -1.0664 3.5347 -5.9831 -1.9292 4.0539 F2(:,:,199) = -5.0046 -1.0259 2.9787 -0.4699 -0.8599 3.6101 -5.8538 -1.4182 4.4357 F2(:,:,200) = -4.8889 -0.6201 3.2688 -0.3251 -0.6569 3.6682 -5.6802 -0.8964 4.7838
function dR = fun1(t,R,R1,R2)
F1 = reshape(R,size(R1));
W_12 = (R1'*R2-R2'*R1);
FA = F1*sign(W_12);
dR = FA(:);
end
function dR = fun2(t,R,R1,R2)
F2 = reshape(R,size(R2));
W_21 = sign(R2'*R1-R1'*R2);
W_2 = W_21;
FA = F2*W_2;
dR = FA(:);
end

Torsten
Torsten on 24 Feb 2023
Edited: Torsten on 24 Feb 2023
From the documentation of ode45:
y0 — Initial conditions
vector
Initial conditions, specified as a vector. y0 must be the same length as the vector output of odefun, so that y0 contains an initial condition for each equation defined in odefun.
This is not true for your code. In your case, y0 is a matrix.
And take care when you return dy from your function fun1 or fun2, that the simple reshaping FA(:) to a column vector leaves the entries of FA at the correct positions.
  1 Comment
Yokuna
Yokuna on 26 Feb 2023
In my case y0 should be given as a vector or a matrix? Is it really solving \dot R=R w?

Sign in to comment.

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!