f(1)=10; %% Ratation angle (Rad)
w(1)=0; %% Angular velocity (Rad/sec)
E(1)=0; %% Angular acceleration
t(1)=0; %% Time vector (sec)
dt=0.001;N=10000;%% The main code
for i= 1:N t(i+1)=t(i)+dt; E(i)=-f(i); w(i+1)=w(i)+E(i)*dt; f(i+1)=f(i)+w(i)*dt;endplot(t,f);
MATLAB: When I plot f towards time amplitude is increasing I don’t know why. It should be constant. what’s wrong
harmonic oscilationspring mass system
Best Answer