Time delay in matlab fuction block used in simulink model.

3 views (last 30 days)
Hi, I developed a power system in simulink. Here, i also use matlab function block and some coding in it. Now i want that when simulink power system starts to simulate, then matlab function block do not operate for first 2 seconds of simulation. In other words i want 2 second time delay of matlab function block. How can i perform that?
Thanks

Accepted Answer

Jim Riggs
Jim Riggs on 30 Jul 2018
Edited: Jim Riggs on 30 Jul 2018
Place your Matlab function block into a triggered subsystem block (or an enabled subsystem block), then trigger/enable the block based on time.
  11 Comments
Jim Riggs
Jim Riggs on 30 Jul 2018
Edited: Jim Riggs on 30 Jul 2018
function y = fcn(A,time)
if(time <= 2.0)
y=1;
else
if (A >= 1.8200e+06)
y=0;
else
y=1;
end
end

Sign in to comment.

More Answers (0)

Categories

Find more on Simulink in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!