looping one variable for single output that represents all looping

1 view (last 30 days)
Hello Guys,
best wishes to all of us. I beg for help in solving this case. I have a list of programs as follows, the K2 variable is looped from the input data. each k2 is processed and produces output x1. what is the solution if all the k2 repetitions that have been done produce x1 which includes all repetitions. the point is that the loop k2 does produce one x1 data output that represents all repeated k2.
input='data';
keka=xlsread(input,1)
for i = 1:size(keka)
k2 = keka(i);
m1 = 213708.6865;
m2 = 42741.73731;
k1 = 20510918.455;
t = 0:0.01:29.99;
zeta1 = 0.05;
c1=zeta1*(2*sqrt(k1*m1));
deltaW2 = 632332.;
Xx2 = 0.02;
womegadamper2 = 0.1;
c2 = deltaW2/(pi*womegadamper2*(Xx2^2));
MA=[m1 0;0 m2];
KA=[k1+k2 -k2;-k2 k2];
[V,D]=eig(KA,MA);
omega=sqrt(D);
w1=omega(1,1);
w2=omega(2,2);
%%sys x1
pembilang1 = [m2 c2 k2];
penyebut1 = [m1*m2 m1*c2+m2*c1+m2*c2 m1*k2+c1*c2+m2*k1+m2*k2 c1*k2+c2*k1 k1*k2];
sys1 = tf (pembilang1,penyebut1);
%%sys x2
pembilang2 = [-c2 -k2];
penyebut2 = [m1*m2 m1*c2+m2*c1+m2*c2 m1*k2+c1*c2+m2*k1+m2*k2 c1*k2+c2*k1 k1*k2];
sys2 = tf (pembilang2,penyebut2);
file='test';
PK = xlsread(file,1);
Gaya=30000.*PK;
x1 = lsim (sys1,gaya,t);
x2 = lsim (sys2,gaya,t);
end
k (1) produces x1 and for k (2) produces x1 which does not eliminate the results of x1 (k1).

Answers (1)

Matt J
Matt J on 13 Sep 2018
x1(i) = lsim (sys1,gaya,t);

Categories

Find more on Robust Control Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!