How to terminate ODE at particular point?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
sangita kamat
am 30 Sep. 2020
Bearbeitet: Walter Roberson
am 12 Okt. 2020
I have defined this ODE as function qd2=odefcn2(t2,q2)
where t2=pi/4:0.5:pi/2; and q2=[ [q12;q22;q32];
after running above ODE I am getting result as
4.1706 9.2403 1.5708
4.2743 9.3530 1.5707
4.3779 9.4658 1.5705
4.4816 9.5785 1.5704
4.5853 9.6912 1.5703
4.6889 9.8040 1.5701
4.7926 9.9167 1.5700
4.8963 10.0294 1.5699
4.9999 10.1422 1.5697
5.1036 10.2549 1.5696
5.2073 10.3676 1.5695
5.3109 10.4804 1.5693
5.4146 10.5931 1.5692
5.5183 10.7058 1.5691
5.6219 10.8186 1.5690
5.7256 10.9313 1.5688
5.8293 11.0440 1.5687
5.9329 11.1568 1.5686
6.0366 11.2695 1.5684
6.1402 11.3822 1.5683
6.2439 11.4950 1.5682
6.3476 11.6077 1.5680
6.4512 11.7204 1.5679
6.5549 11.8332 1.5678
6.6586 11.9459 1.5676
6.7622 12.0586 1.5675
6.8659 12.1714 1.5674
6.9696 12.2841 1.5672
7.0732 12.3969 1.5671
7.1769 12.5096 1.5670
7.2806 12.6223 1.5668
7.3842 12.7351 1.5667
7.4879 12.8478 1.5666
7.5916 12.9605 1.5664
7.6952 13.0733 1.5663
7.7989 13.1860 1.5662
7.9026 13.2987 1.5660
8.0062 13.4115 1.5659
8.1099 13.5242 1.5658
8.2136 13.6369 1.5657
8.3172 13.7497 1.56
these are total 41 rows ,if i want to stop at q(30,:) what is the matlab code for this?
thank you
0 Kommentare
Akzeptierte Antwort
Ameer Hamza
am 30 Sep. 2020
If you just want to delete the solutions after forty lines of code, then you can do it like this
q(31:end, :) = []
However, if you want to stop the ode solver at that point, then read about ODE events: https://www.mathworks.com/help/matlab/ref/odeset.html#d122e899781. Also check the example here: https://www.mathworks.com/help/matlab/math/ode-event-location.html
10 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations 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!