How to do Feedback Loop on Simulink with different frequinces
Show older comments
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.
Accepted Answer
More Answers (1)
Paul
on 24 Jun 2022
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.
2 Comments
Esin Derin
on 24 Jun 2022
Paul
on 24 Jun 2022
I missed a step:
Add two To Workspace blocks and connect them to the same signals that are feeding the scopes.
Categories
Find more on Simulink in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


