Making Pulse sequence with if commands in Embeded MATLAB Function in simulink

조회 수: 1 (최근 30일)
Hello. I have written a code which makes a pulse pattern. It has a repetitive sawtooth time input that ensures the pulse pattern to be periodic. Times of pulse transitions are given to Matlab function as inputs and the pulse pattern is made using two condition if (if a<b && b<c which b is the instantaneous time of the pulse and a,c are the start and end of pulse segment.) Here is a snapshot of my code:
Here is a snapshot of my simulink blocks:
and finally, here is my output:
Now my question is: I do not expect that (for example) the third segment of the output pulse has the value of 0.03, I expect it as 0.01. because in the matlab function, on the third case, my output should be u4-u3, which u4=0.035 and u3=0.025, then, my output should be 0.01 (not 0.03).
I appreciate your help
I have attached the mdl file for more information.

채택된 답변

Purushottama Rao
Purushottama Rao 2015년 8월 18일
편집: Purushottama Rao 2015년 8월 18일
When U1 is between u4 and u5, y=u5-u4=0.065-0.035
That is why you have 0.03 magnitude at your output

추가 답변 (2개)

vahid
vahid 2015년 8월 18일
Here is my mdl file (that I forgot to attach)
  댓글 수: 2
Purushottama Rao
Purushottama Rao 2015년 8월 18일
Attach the model using 'Attch file' option. Or can you give your sawtooth wavefrom??
vahid
vahid 2015년 8월 18일
Hello Mr Purushottama Rao, thanks for your comment, I have attached the model a comment before your comment. Here is my sawtooth signal that is a periodic one with T=0.1 s and min value of 0 and peak value of 0.1, in order to represent a periodic time (clock) function.

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


vahid
vahid 2015년 8월 18일
Sorry sir, you are right. I considered the 0.1 output as a single if state, while actually it was two consecutive if statestates. I really appreciate your help.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by