Having trouble getting this to work even tho it says it matches in the workspace i = 921 and c = 921×1 double but its give ther error in the for loop that alpha can not run with contains the 921×1 array. Any help would be appreciated.
t=0:i; theta=zeros(i,1);omega=zeros(i,1);alpha=zeros(i,1);Fr=zeros(i,1);theta(1,:)=deg2rad(90); % initial angular position
omega(1,:)=0; % initial angular velocity
alpha(1,:)=0; % initial angular acceleration
% Iteratively solve equations of motion using Euler's Method
for n=1:i theta(n+1,:)=theta(n,:)+omega(n,:)*dt; % new angular position
omega(n+1,:)=omega(n,:)+alpha(n,:)*dt; % new angular velocity
alpha(n+1,:)=(-g*sin(theta(n+1,:)))/L-c(:,1)*omega(n+1,:); % new angular acceleration
Fr(n+1,:)=mass*g*cos(theta(n+1,:))+mass*L*(omega(n+1,:)).^2; % Reaction Force
end
Best Answer