Making Pulse sequence with if commands in Embeded MATLAB Function in simulink
4 views (last 30 days)
Show older comments
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/148183/image.jpeg)
Here is a snapshot of my simulink blocks:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/148184/image.jpeg)
and finally, here is my output:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/148187/image.jpeg)
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.
0 Comments
Accepted Answer
Purushottama Rao
on 18 Aug 2015
Edited: Purushottama Rao
on 18 Aug 2015
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
0 Comments
More Answers (2)
vahid
on 18 Aug 2015
2 Comments
Purushottama Rao
on 18 Aug 2015
Attach the model using 'Attch file' option. Or can you give your sawtooth wavefrom??
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!