how can i generate sinusoidal signal from PS repeating Sequence block of simscape ?

7 次查看(过去 30 天)

回答(1 个)

Abhishek
Abhishek 2025-6-27
To generate a sinusoidal signal of frequency, say 50 Hz using the “PS Repeating Sequence” block, follow the steps:
  • From the block parameters of “PS Repeating Sequence”, select the “Signal type” as continuous.
  • To get the “Durations” and “Start output values”, run the script below in “Command Window” which helps in generating these parameters.
f = 50; % Frequency (Hz)
T = 1/f; % Period (s)
N = 20; % Number of segments
dt = T/N; % Duration of each segment
durations = dt * ones(1, N); % Equal durations for each segment
t = linspace(0, T-dt, N); % Start times for each segment
start_output_values = sin(2*pi*f*t); % Sine values at each segment start
  • These parameters will be generated in “Workspace” window which can be accessed in block parameters of PS Repeating Sequence by entering the variable names into their respective fields as shown in the image below:
  • Additionally, connect a “Solver Configuration” block to the model, as shown below:
  • Connect a Scope and run the simulation to view the output
As per the documentation, the PS Repeating Sequence supports up to 100 segments. For more detailed understanding on how the PS Repeating Sequence block works, refer to its documentation: https://www.mathworks.com/help/releases/r2025a/simscape/ref/psrepeatingsequence.html

类别

Help CenterFile Exchange 中查找有关 Troubleshooting 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by