Simulink: Creating a repeating irregular square wave
6 views (last 30 days)
Show older comments
Alexander Flyckt
on 21 Apr 2015
Commented: Alexander Flyckt
on 23 Apr 2015
I want to genereate a square wave to represent different uptimes for a lightning installation over a year.
The schedule over a week is the following: Mon-Thu: 06.00-20.00 Fri: 06.00-18.00 Sat: no uptime Sun: no uptime
So my wave should repeat every 168 hours (one week) and look like this:
Time Signal
0-6 0
6-20 1
20-30 0
30-44 1
44-54 0
54-68 1
68-78 0
78-94 1
94-104 0
104-116 1
116-168 0
I've tried some with the repeating sequence block using the following:
Time values:[0 6 6.001 20 20.001 30 30.001 44 44.001 54 54.001 68 68.001 78 78.001 94 94.001 104 104.001 116 116.001 168]
Output values: [0 repmat([0 1 1 0],1,5) 0]
But since I'm simulating over 8760 (a year in hours) it seems that the step is f*cking things up.
Is there any better way or good way to make this work?
Thanks a bunch.
0 Comments
Accepted Answer
Navaneeth Raman
on 22 Apr 2015
Hi,
You can try a couple of things:
1. Try to use discrete solver and see if this is an issue. 2. Check the scope settings to see if you are plotting the data for 24 hours. You might have to uncheck the 'Only 5000 data points' option.
HTH, Navaneeth
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!