Control System with Feedback Loop

3 次查看(过去 30 天)
I'm trying to connect Simulink with Matlab codes but always get unable to load block diagram error. And I can't get gain and time constant from scope 2.If you could help, it would be wonderful.
%Feedback Loop
TransferF1=tf([4],[5 1]);
TransferF1=tf([4],[5 1]);
%Feedback Loop with different Frequinces
G=tf([4],[5 1]);
K=0;
Gcl=G/[1+K*G];
K1=5;
Gcl1=G/[1+K1*G];
K2=-1;
Gcl2=G/[1+K2*G];
K3=-0.5;
Gcl3=G/[1+K3*G];
ltiview('bode',Gcl,Gcl1,Gcl2,Gcl3)
freqvec = [0.1 0.2 0.4]; % choose whatever frequencies are needed
for ii = 1:numel(freqvec)
freqHz = freqvec(ii);
out = sim('kontrollab2diagram'); % use the actual name of the .slx file
% do whatever processing is needed on out
end

采纳的回答

Sam Chak
Sam Chak 2022-6-25
It can be very frustrating when one is not familiar with the MATLAB coding + Loop, and pressurized to complete the Lab report. When I look into the task, it does not require you to use Looping. Thus, I'd suggest you do something very simple like this to get very comfortable at modeling. Record the Scope output and paste it into your lab report. When you have free time later, slowly explore the program and additional features that you are interested in.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Dynamic System Models 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by