필터 지우기
필터 지우기

Help associating ode events (if they occur?) to plotted symbols and legends

조회 수: 2 (최근 30일)
Brantosaurus
Brantosaurus 2022년 12월 22일
댓글: Walter Roberson 2022년 12월 22일
I have identified 4 ode events. The integration stop event which will occur, but the other 3 might not. The events function order list, intended symbol on a graph and accompanying legend are:
n - symbol - legend
1 - 'kx' - 'end' (integration stop)
2 - 'k.' - 'vertex'
3 - 'kv' - 'threshold decreasing'
4 - 'k^' - 'threshold increasing'
If possible, I would basically like to plot something like:
hold on
plot(t,y))
plot(te1,ye1),'symbol1')
plot(te2,ye2),'symbol2') - might not occur
plot(te3,ye3),'symbol3') - might not occur
plot(te4,ye4),'symbol4') - might not occur
hold off
legend(anything,legend1,legend2,legend3,legend4) - later legends might not occur
So far, chronological events in the 'ie' matrix are [3;2;4;1] or [2;3;4;1], but this might change!
Try as i may, i cannot correctly accociate events with plotted symbols or legends, let alone instances where they might not occur!
Any help or advice on how i might achieve this would be greatly appreciated.
  댓글 수: 3
Brantosaurus
Brantosaurus 2022년 12월 22일
Yes i believe.
options = odeset('events',@trajevents)
[t,y,te,ye,ie] = ode45(@state,tspan,yo,options)
:
function [check,stop,direction] = trajevents(t,y)
check, stop and direction each contain details which sucessfully trigger the 4 events.
All the workspace outputs look fine and the basic full span plots of [t,y] and 4 discrete [te(ie),ye(ie)].
The plotting of [te(ie),ye(ie)] with symbol and legend associations are the problem even when 4 events occur, which might not always be the case!
The images show what i would like to achieve. The order of events and number can change.
Walter Roberson
Walter Roberson 2022년 12월 22일
What difficulty are you encountering? It would probably be easier if you could post code for us to test.
Question: if an event does not occur then should it still appear in the legend?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Legend에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by