How to do Feedback Loop on Simulink with different frequinces

1 次查看(过去 30 天)
Hello, I'm trying to build a Simulink for a open and closed loop. I have to put harmonic input signal (instead of step) with amplitude 3. Input the signal into closed and open system. And found the amplitude of the output signal for both systems. Then I have to change the signal frequency 0.1 Hz to 100 Hz with increasing step ( 0.1Hz, 0.2 Hz, 0.4 Hz .... )
Attached here, you can find my diagram.

采纳的回答

Sam Chak
Sam Chak 2022-6-24
编辑:Sam Chak 2022-6-24
First, you need to construct the frequency {0.1, 0.2, 0.4, 0.8, 1.6, ...} based on the following sequence that depends on the integer variable , which is constructed using a summation of Step functions. Note that mathematically, the sequence won't arrive exactly at 100 Hz, but 102.4 Hz.
Next, construct the Input Sine wave with varying sequential frequency.
The overall system looks like this. The step times of the 11 Step function blocks are implied in the Block names.
Then, run the simulation and plot the outputs.

更多回答(1 个)

Paul
Paul 2022-6-24
I'm assuming the question is how to run the same simulation multiple times for different frequencies. With this assumption ....
1. Replace the block labeled Sine Wave Function with the Sine Wave block
2. Double click the Sine Wave block, set the Amplitude parameter to 3, set the Frequency parameter to: freqHz*2*pi (enter it exactly that way).
3. In the Matlab workspace, or in a script, implement
freqvec = [0.1 0.2 0.4]; % choose whatever frequencies are needed
for ii = 1:numel(freqvec)
freqHz = freqvec(ii);
out = sim('Esin'); % use the actual name of the .slx file
% do whatever processing is needed on out
end
Depending on what you're actually doing, the model and/or the code above might have to be modified, but this should be enough to give the basic idea.
I believe there is also a doc page that explains alternatives methods for running multiple simulations for a parameter sweep.

标签

Community Treasure Hunt

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

Start Hunting!

Translated by