[Simulink] Create chirp signal in trigger subsystem block

11 visualizaciones (últimos 30 días)
Nguyen Ngoc
Nguyen Ngoc el 7 de En. de 2024
Comentada: Nguyen Ngoc el 29 de En. de 2024
Hello everybody
I want to create a chirp signal that only run when I press the push button like this:
In the link above, the signal is the sine signal, therefore the file can run smoothly. However, when I change to chirp signal, this can not run because the sample time of chirp signal is not inherited:
I want to ask how can I create a chirp signal that only run when I want?
Thank you very much
Edit 1: Sorry for the confusion, I want to replace the Enabled Subsystem by the Triggered Subsystem.
I have attached the file. The Matlab release is 2022b.
Edit 2: The reason I want to use the Triggered Subsystem is because I want the signal starting to run when I press the button (ON). If I use the Enabled Subsystem, the signal will start to run at the begining of the simulation and will show on the scope when I press ON. Please correct me if I wrong. Thank you very much.
Edit 3: I have put the 3 blocks: Enabled Subsystem_sine, Enabled Subsystem_chirp and Triggered Subsystem_chirp for you to compare.
Edit 4: I have put the 4 blocks: Enabled Subsystem_sine, Enabled Subsystem_chirp, Triggered Subsystem_chirp, Enabled Subsystem_Signal_builder for you to compare.
Edit 5: I have updated the file so that it's easier to understand. I will use the signal builder to build a more specific signal so that it's easier to see what I want.
First, I run the simulation for 3s when the swich is OFF:
After 3s, I press the button to ON:
You can see the result in the picture below:
What I want is the signal start rising at 3s as the red line in the picture below:
I hope it's more clarify.
  7 comentarios
madhan ravi
madhan ravi el 8 de En. de 2024
Movida: madhan ravi el 8 de En. de 2024
I am not sure what you are referring to. You can hold your states or reset it in the Enabled subsytem.
Nguyen Ngoc
Nguyen Ngoc el 8 de En. de 2024
Movida: madhan ravi el 8 de En. de 2024
Thank for your reply, I will be more specific.
I have updated the file so that it's easier to understand. I will use the signal builder to build a more specific signal so that it's easier to see what I want.
First, I run the simulation for 3s when the swich is OFF:
After 3s, I press the button to ON:
You can see the result in the picture below: (please ignore the legend: Enabled subsystem_chirp; it should be: Enabled subsystem_signal_builder)
What I want is the signal start rising at 3s as the red line in the picture below:
I hope it's more clarify.

Iniciar sesión para comentar.

Respuesta aceptada

R
R el 25 de En. de 2024
Editada: R el 29 de En. de 2024
Hi Nguyen,
Thank you for providing your model and the output to explain your case.
As you correctly identified, the Chirp Signal block in Simulink doesn't inherently adhere to a sample time and executes at the Simulink runtime. To address this, refer to the attached model (Image for reference):
Your requirement can be met if you know how much of a delayed start you want to assign the chirp signal. Refer to ‘Delayed Chirp’ subsystem in the attached model, which employs a ‘Transport Delay’ block to buffer the input signal by a defined delay. In the model, I set it to 3 seconds and as a result in the `t_delay_chirp` signal plot, you can observe it starting at 3s in the Scope output below:
The enabled subsystem that you used is demonstrating the right behavior. It retains the previous value (0 initially), until the button is pressed- where it enables the output from the subsystem. Refer to the plots of `enabled_chirp` and `normal_chip` is identical until the trigger is enabled after around 3 seconds.
Depending on your specific needs, you can choose between the two available options and modify your approach accordingly.
  3 comentarios
R
R el 29 de En. de 2024
Sure, I've edited my answer to include the model saved in MATLAB R2021b. Hope this helps!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Subsystems en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by