[Simulink] Create chirp signal in trigger subsystem block
4 次查看(过去 30 天)
显示 更早的评论
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 个评论
madhan ravi
2024-1-8
移动:madhan ravi
2024-1-8
I am not sure what you are referring to. You can hold your states or reset it in the Enabled subsytem.

采纳的回答
R
2024-1-25
编辑:R
2024-1-29
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 个评论
R
2024-1-29
Sure, I've edited my answer to include the model saved in MATLAB R2021b. Hope this helps!
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subsystems 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!