Filter löschen
Filter löschen

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

2 Ansichten (letzte 30 Tage)
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

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 14 Feb. 2014
Bearbeitet: Azzi Abdelmalek am 14 Feb. 2014
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 Kommentare
CHANDRA SHEKHAR BESTA
CHANDRA SHEKHAR BESTA am 14 Feb. 2014
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Structures finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by