errors in matlab function block in simulink

조회 수: 2 (최근 30일)
mohamed samhy
mohamed samhy 2016년 4월 11일
편집: mohamed samhy 2016년 4월 15일
i am trying to create a matlab function block in the Simulink that generates square pulses as pulse generator but errors appear please help , I attached screenshots.
<<
>>

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2016년 4월 11일
Your code is not correct. Plus, generating a puls train with Matlab function is not a good idea. You have to know that your Matlab function block, the way it's programmed, will outpu,t each sample time, an entire array.
You can generate such signal with from file block, from worksapce block or using repeated sequence
If you want to use from file block
Fs=1e+9
tend=10*4e-6
t=0:1/Fs:tend;
pulsewidth=1e-6
pulseperiods=(0:10)*4e-6
x=pulstran(t,pulseperiods,'rectpuls',pulsewidth)
v=[t;x];
save yourfile v
Then set the name "yourfile" in the frome file block
  댓글 수: 28
Azzi Abdelmalek
Azzi Abdelmalek 2016년 4월 12일
Here a simulink model
mohamed samhy
mohamed samhy 2016년 4월 15일
편집: mohamed samhy 2016년 4월 15일
it did work ,man you are such a great helpful person hope u have a happy life for helping people so much . thanks again man :)

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

카테고리

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