how to acces and change value inside transfer function inside a loop

3 次查看(过去 30 天)
i'm trying to change the k value from 0.1 to 7 that is inside transfer function but i have a problem i just don't know how to find the index inside this cells please help.
this is my code:
clear all
clc
kvals=0.1:0.1:7; % Change the values of k parameter
for kidx=1:length(kvals);
k=kvals(kidx);
G(kidx)=tf([k],[10*10^-3 1]);
GG=tf([G.num{1,1}],[G.den{1,1}(k)]);
Gtotal(kidx)=feedback(GG,1);
%TAU(kidx)=(G(k).den{1}(1))/(G(k).num{1}(2));
end

采纳的回答

Craig Cowled
Craig Cowled 2013-4-25
Kobi, I tried running your code and got an error message. It looks like you missed a space between G.den{1,1} and (k) in the line GG=tf([G.num{1,1}],[G.den{1,1} (k)]);
Is this the problem?

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by