필터 지우기
필터 지우기

Simulink: Creating a repeating irregular square wave

조회 수: 3 (최근 30일)
Alexander Flyckt
Alexander Flyckt 2015년 4월 21일
댓글: Alexander Flyckt 2015년 4월 23일
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.

채택된 답변

Navaneeth Raman
Navaneeth Raman 2015년 4월 22일
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
  댓글 수: 1
Alexander Flyckt
Alexander Flyckt 2015년 4월 23일
Using a discrete solver and then unchecking the "only 5000 data points" solved the problem, thanks alot!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Scopes and Data Logging에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by