필터 지우기
필터 지우기

How to solve this problem equation with loop?

조회 수: 1 (최근 30일)
Leonardus Risky
Leonardus Risky 2018년 7월 30일
답변: KSSV 2018년 7월 30일
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.

채택된 답변

KSSV
KSSV 2018년 7월 30일
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개)

카테고리

Help CenterFile 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