Event base simulation in matlab

2 次查看(过去 30 天)
Hi, I don't know how to do event based simulation in matlab. Just need a start for it, this question is a start part of my bigger task.
i have this,
arrival_departure_frequency =
0.0000 5.9489 0
0.0000 6.6353 0
0.0001 6.9292 0
0.0001 6.9361 0
0.0001 7.2979 0
0.0001 7.7989 0
0.0002 7.9419 0
0.0002 8.8358 0
0.0002 8.8383 0
0.0002 9.0600 0
First column is my event_arrivals and the 2nd column is event_departure. I want to change the value of third column from 0 to 1 when the simulation is in between arrival time and the departure time.
Once the event_departure arrives it again back set to O. Thank you so much.
  27 个评论
Aftab Ahmed Khan
Aftab Ahmed Khan 2014-6-12
Hi, I just managed what i wanted to achieve. Thank you so much dear. i really appreciate your time and support. Take care......
Abhishek M
Abhishek M 2014-6-13
Cool.. I saw your recent query. That question seems to be more clear than this. Anyways good to know you got your solution.
Cheers.

请先登录,再进行评论。

采纳的回答

Abhishek M
Abhishek M 2014-6-11
Hi Aftab, I insist you to use stateflow for this logic. You can create your events and trigger the output based on your logic.
  3 个评论
Aftab Ahmed Khan
Aftab Ahmed Khan 2014-6-11
Hello, i have tried up to this point but how can i introduce the departure time with it.
for i =1:10
timenow = event_arrivals(i);
no_channels = find(BS_channeltable == 0);
first_available = min(no_channels);
if timenow == (event_arrivals(i))&& (first_available ~=0)
BS_channeltable(first_available)=1;
end
end
Please help me with it.
Aftab Ahmed Khan
Aftab Ahmed Khan 2014-6-11
编辑:Aftab Ahmed Khan 2014-6-11
Hi,
I have managed up to this point but how can i release the channel from it as it will never reach to the departure time of the files.
for i =1:10
timenow = event_arrivals(i);
no_channels = find(BS_channeltable == 0);
first_available = min(no_channels);
%%Allocating the Channel on the file arrival
if timenow == (event_arrivals(i))&&(first_available ~=0)
BS_channeltable(first_available) = 1;
fprintf(fid,'Frequency is assigned.\n');
Releasing the channel on file departure
elseif timenow == event_departures(i)
release_channel = find(BS_channeltable==1);
last_occuped = max(release_channel);
BS_channeltable(last_occuped) = 0;
fprintf(fid,'Frequency is released.\n');
end
end
and how can i get my simulation to the departure time?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Polar Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by