How to store the result of each iteration of a forloop into MATLAB

1 次查看(过去 30 天)
How to store the result of each iteration of a forloop into MATLAB.
This program calculating Transfer functions.
But, when i am using this "v".
I am getting last element only.
Can you please help me, How to store every iteration result in MATLAB.
This is the program. Thank you.
clc
K=[-0.098 -0.036 -0.014 -0.017;
-0.043 -0.092 -0.011 -0.012;
-0.012 -0.016 -0.102 -0.033;
-0.013 -0.015 -0.029 -0.108] ;
L=[17 27 32 30;
25 16 33 34;
31 34 16 26;
32 31 25 18];
T=[122 149 158 155;
147 130 156 157;
153 151 118 146;
156 159 144 128];
one=[1 1 1 1;
1 1 1 1;
1 1 1 1;
1 1 1 1];
for i=1:4
for j=1:4
v=tf([K(i*j)],[T(i*j) one(i*j)], [L(i*j)]);
end
end

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2014-2-14
编辑:Azzi Abdelmalek 2014-2-14
for i=1:4
for j=1:4
v{i,j}=tf([K(i*j)],[T(i*j) one(i*j)], [L(i*j)]);
end
end
%to get the transfer function for i=3 and j=2 for example
v{3,2}
  4 个评论
CHANDRA SHEKHAR BESTA
Sir, i am getting all elements. But, I am not getting all elements in proper dimension. can you please correct my for loop code to get correct transfer function matrix for the above program.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Whos 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by