[Simulink] Create chirp signal in trigger subsystem block

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 Comments

Can you share your model and tell us which release you used? It's best to reproduce the issue with the model.
Like @Angelo Yeo mentions it"s better to know the release. I had no problems running the model in 2023b from the link and replacing it with chirp signal block, didn"t check it for Enabled Subsystem. Note: in the link Enabled Subsystem was used and you are using Triggered Subsytem.
Thank for your reply, I have updated my question with the file
Enabled subsytem should suffice your use case.
By the way, you are using r2021b not r2022b.
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. If you let the button at OFF and run for 3s, then press ON, the signals show in the scope will be the same. I want it to start when I press ON, which mean the signals must be different. Please correct me if I wrong.
I am not sure what you are referring to. You can hold your states or reset it in the Enabled subsytem.
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.

Sign in to comment.

 Accepted Answer

R
R on 25 Jan 2024
Edited: R on 29 Jan 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 Comments

Thank you, can you save the simulink file into the older version? I'm using the Matlab 2021b.
Sure, I've edited my answer to include the model saved in MATLAB R2021b. Hope this helps!

Sign in to comment.

More Answers (0)

Products

Release

R2021b

Asked:

on 7 Jan 2024

Commented:

on 29 Jan 2024

Community Treasure Hunt

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

Start Hunting!