How to solve this problem equation with loop?

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.

 采纳的回答

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

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by