simulate a variable from 0 to 255 in simulink

조회 수: 1 (최근 30일)
Felipe Arriagada
Felipe Arriagada 2011년 7월 1일
I need to simulate a variable from 0 to 255. And after they return from 255 to 0 and so continuously, all in simulink. I need this to simulate a variable "pv" signal processing (level control)
thanks
  댓글 수: 1
Fangjun Jiang
Fangjun Jiang 2011년 7월 2일
You want the pv value increase by 1 from 0 to 255 and then come back. What is the time vector? Every 1 second change from 1 to 2, or every 1ms from 1 to 2?

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

채택된 답변

C.J. Harris
C.J. Harris 2011년 7월 1일
This setup should do what you need:
Create a constant (1 for example), feed that into an integrator block, then feed that into the 'mathematical function' block (set to 'mod'), and set the second input to 255.
Increasing or decreasing the first variable will control how fast your variable counts up.
  댓글 수: 2
Felipe Arriagada
Felipe Arriagada 2011년 7월 1일
I get an error.
Warning: Using a default value of 0.2 for maximum step size. The simulation step size will be equal
to or less than this value. You can disable this diagnostic by setting 'Automatic solver parameter
selection' diagnostic to 'none' in the Diagnostics page of the configuration parameters dialog
This is the setup? http://felipedream.zobyhost.com/cunting.jpg
C.J. Harris
C.J. Harris 2011년 7월 4일
Your image doesn't work, but all that warning is saying is that if you are using a fixed step solver your simulation time should be a multiple of your step time.

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

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by