フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

problem inside a for loop while trying to change values inside matlab functions

1 回表示 (過去 30 日間)
Kobi
Kobi 2013 年 4 月 21 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
please help i don't understand what am i doing wrong
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]);
Gtotal(kidx)=feedback(G(k),1);
TAU(kidx)=(0.01)/(G(k).num{1,1}(2));
end
this thing just won't work.
  1 件のコメント
Walter Roberson
Walter Roberson 2013 年 4 月 21 日
What difficulty are you encountering? Is there an error message?

回答 (1 件)

Rahul Narendra Shanbhag
Rahul Narendra Shanbhag 2020 年 6 月 18 日
Hi Kobi,
I noticed that you are trying to create an array of transfer function variables. However, you have not declared the variable initially. This causes errors since the tf function gives a system model object as output.
Please refer to the section Array of Transfer Function Models in the given document on how to pre-allocate the transfer function array.
Also, you seem to have made syntactical errors in line 7 and 8 of your uploaded code, where you are trying to access the said tf array by using the variable k. However, k is a non-integer and cannot be used as an array index. Array indices must be positive integers.
Thanks

この質問は閉じられています。

製品

Community Treasure Hunt

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

Start Hunting!

Translated by