Azzera filtri
Azzera filtri

How to solve this problem equation with loop?

1 visualizzazione (ultimi 30 giorni)
Hello everybody, i have some calculations here using loop and i want here is to solve Resp Variable which is depent or functions of time where there is another variable here (such as tehtadot) is a function of time too. I want to plot result is time Vs Resp Variable. My Problem is i try using this program but the Resp Variable doesn't became a matrix (Varible time from tstart and tstop let say from 0-4 second when delta t is 0.0001). Thank You.

Risposta accettata

KSSV
KSSV il 30 Lug 2018
M = [14.29 0; 0 14.29];
beta = 0.0002;
C1 = [150000 0; 0 375000];
C2 = [0 -2.871; 2.871 0];
K1 = [1345000 0; 0 1570000];
K2 = [0 -2.871; 0 0];
tstart = 0;
tstop = 4;
deltat = 0.001;
sbx = tstart:deltat:tstop;
Resp = zeros(1,length(sbx)) ;
for i = 1:length(sbx)
t = sbx(i) ;
tethadot = 1250*t;
tetha = (1250*(t^2))/2;
tethaddot = 1250;
C = C1 + (tethadot.*C2);
K = K1 + (tethaddot.*K2);
F1 = [1.299*(10^-5)*sin(tetha);1.299*(10^-5)*cos(tetha)];
F2 = [-1.299*(10^-5)*cos(tetha);1.299*(10^-5)*sin(tetha)];
f1 = (tethadot.^2).*F1;
f2 = (tethaddot.^2).*F2;
F = f1 + f2;
A = (4.*M)./(deltat^2) + (2/deltat).*C + K;
dresp = A\F;
Resp(i) = sqrt(dresp(1)^2+dresp(2)^2);
end
figure(1)
plot(sbx,Resp)
grid on

Più risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by