Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 921-by-1.

Asked by Wilfredo Huaman

Wilfredo Huaman (view profile)

on 14 Jun 2019
Latest activity Answered by Geoff Hayes

Geoff Hayes (view profile)

on 14 Jun 2019
Accepted Answer by Geoff Hayes

Geoff Hayes (view profile)

Having trouble getting this to work even tho it says it matches in the workspace i = 921 and c = 921x1 double but its give ther error in the for loop that alpha can not run with contains the 921x1 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

Answer by Geoff Hayes

on 14 Jun 2019