errors in matlab function block in simulink
Mostrar comentarios más antiguos
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.
<<

>>


Respuestas (1)
Azzi Abdelmalek
el 11 de Abr. de 2016
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 comentarios
mohamed samhy
el 11 de Abr. de 2016
Azzi Abdelmalek
el 11 de Abr. de 2016
No, in a script, or Windows Command. The aim is to create the file that contains your signal.
mohamed samhy
el 11 de Abr. de 2016
Azzi Abdelmalek
el 11 de Abr. de 2016
Azzi Abdelmalek
el 11 de Abr. de 2016
mohamed samhy
el 11 de Abr. de 2016
Editada: mohamed samhy
el 11 de Abr. de 2016
mohamed samhy
el 11 de Abr. de 2016
Azzi Abdelmalek
el 11 de Abr. de 2016
What error?
mohamed samhy
el 11 de Abr. de 2016
mohamed samhy
el 11 de Abr. de 2016
Azzi Abdelmalek
el 11 de Abr. de 2016
In model configuration parameters set the solver to discret. and set the stop time to tend
mohamed samhy
el 11 de Abr. de 2016
mohamed samhy
el 11 de Abr. de 2016
Azzi Abdelmalek
el 11 de Abr. de 2016
no, set it to tend. because your frequency is very high 1e9. If you want to see quickly your pulse train, set the stop time to t(end) or tend
mohamed samhy
el 11 de Abr. de 2016
Editada: mohamed samhy
el 11 de Abr. de 2016
Azzi Abdelmalek
el 11 de Abr. de 2016
Do you know what is tend?
Azzi Abdelmalek
el 11 de Abr. de 2016
From your code:
tend=10*4e-6
How now it's equal to 200000?
mohamed samhy
el 11 de Abr. de 2016
Editada: mohamed samhy
el 11 de Abr. de 2016
mohamed samhy
el 11 de Abr. de 2016
Editada: mohamed samhy
el 11 de Abr. de 2016
mohamed samhy
el 11 de Abr. de 2016
Azzi Abdelmalek
el 11 de Abr. de 2016
Editada: Azzi Abdelmalek
el 11 de Abr. de 2016
Have you read my previous comment? probably you have cleared the variable tend. before running your simulink model you need to set the variable tend to its original value
tend=10*4e-6
mohamed samhy
el 11 de Abr. de 2016
mohamed samhy
el 11 de Abr. de 2016
Azzi Abdelmalek
el 11 de Abr. de 2016
here the attached mat file
mohamed samhy
el 11 de Abr. de 2016
mohamed samhy
el 11 de Abr. de 2016
Azzi Abdelmalek
el 12 de Abr. de 2016
Here a simulink model
mohamed samhy
el 15 de Abr. de 2016
Editada: mohamed samhy
el 15 de Abr. de 2016
Categorías
Más información sobre Simulink en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


