how to solve "Error using alpha. Too many output arguments."

23 views (last 30 days)
I am getting "Error using alpha. Too many output arguments." after alpha3. Can someone help me resolve this?
%
clear all
close all
% Given
a=3;
b=13;
c=0;
rPA=b/2;
rPB=c/2;
theta2=100; % degrees
theta4=90; % degrees
omega2=2000*2*pi/60; % rpm
alpha2=10; % rad/s^2
w2=1; %lb
w3=2; %lb
w4=4; %lb
g=32.2;
m2=w2/g;
m3=w3/g;
m4=w4/g;
I2=0.02; %lb.ft.s^2
I3=0.08; %lb.ft.s^2
F=[-1000-500]; %lb
% Open Circuit
theta32=asind((-a*sind(theta2)+c)/b)+180;
d2=a*cosd(theta2)-b*cosd(theta32);
% Crossed Circuit
theta31=asind((a*sind(theta2)-c)/b);
d1=(a*cosd(theta2))-(b*cosd(theta31));
% Find torqe T12, pin force F12, pin force F32, pin force F43
theta3=asind((-a*sind(theta2)+c)/b)+180;
omega3=a*omega2*cosd(theta2)/(b*cosd(theta3));
ddot=-a*omega2*sind(theta2)+b*omega3*sind(theta3);
alpha3=(a*alpha*cosd(theta2)-a*omega2^2*sind(theta2)+b*omega3^2*sind(theta3))/(b*cosd(theta3));
Dddot=-a*alpha2*sind(theta2)-a*omega2^2*cosd(theta2)+b*alpha3*sind(theta3)+b*omega3^2*cosd(theta3);
Aa=[-a*alpha2*sind(theta2)-a*omega2^2*cosd(theta2); a*alpha2*cosd(theta2)-a*omega2^2*sind(theta2)];
Ab=[Dddot;0];
R2=a*[cosd(theta2);sind(theta2)];
R12=-R2/2;
R32=R2/2;
R3=b*[cosd(theta3);sind(theta3)];
R23=R3/2;
R43=-R3/2;
rG2=a/2;
rG3=b/2;
A2=[-rG2*alpha2*sind(theta2)-rG2*omega2^2*cosd(theta2); ...
rG2*alpha2*cosd(theta2)-rG2*omega2^2*sind(theta2)];
Aa=[-a*alpha2*sind(theta2)-a*omega2^2*cosd(theta2); a*alpha2*cosd(theta2)-a*omega2^2*sind(theta2)];
Ag3a=[-rG3*alpha3*sind(theta3)-rG3*omega3^2*cosd(theta3);...
rG3*alpha3*cosd(theta3)-rG3*omega3^2*sind(theta3)];
A3=Aa-Ag3a;
A4=[Dddot;0];
A=[1 0 1 0 0 0 0 0
0 1 0 1 0 0 0 0
-R12(2) R12(1) -R32(2) R32(1) 0 0 0 1
0 0 -1 0 1 0 0 0
0 0 0 -1 0 1 0 0
0 0 R23(2) -R23(1) -R43(2) R43(1) 0 0
0 0 0 0 -1 0 mu 0
0 0 0 0 0 -1 1 0];
B=[m2*A2(1)
m2*A2(2)
I2*alpha2
m3*A3(1)
m3*A3(2)
I3*alpha3
m4*A4(1)-F(1)
-F(2)];
F=A\B

Answers (1)

KALYAN ACHARJYA
KALYAN ACHARJYA on 29 Nov 2019
Edited: KALYAN ACHARJYA on 29 Nov 2019
#Done with some minor changed, also mu to m2 (There is no mu variable)
% Given
a=3;
b=13;
c=0;
rPA=b/2;
rPB=c/2;
theta2=100; % degrees
theta4=90; % degrees
omega2=2000*2*pi/60; % rpm
alpha2=10; % rad/s^2
w2=1; %lb
w3=2; %lb
w4=4; %lb
g=32.2;
m2=w2/g;
m3=w3/g;
m4=w4/g;
I2=0.02; %lb.ft.s^2
I3=0.08; %lb.ft.s^2
F=[-1000 -500]; %lb
% Open Circuit
theta32=asind((-a*sind(theta2)+c)/b)+180;
d2=a*cosd(theta2)-b*cosd(theta32);
% Crossed Circuit
theta31=asind((a*sind(theta2)-c)/b);
d1=(a*cosd(theta2))-(b*cosd(theta31));
% Find torqe T12, pin force F12, pin force F32, pin force F43
theta3=asind((-a*sind(theta2)+c)/b)+180;
omega3=a*omega2*cosd(theta2)/(b*cosd(theta3));
ddot=-a*omega2*sind(theta2)+b*omega3*sind(theta3);
alpha3=(a*alpha2*cosd(theta2)-a*omega2^2*sind(theta2)+b*omega3^2*sind(theta3))/(b*cosd(theta3));
Dddot=-a*alpha2*sind(theta2)-a*omega2^2*cosd(theta2)+b*alpha3*sind(theta3)+b*omega3^2*cosd(theta3);
Aa=[-a*alpha2*sind(theta2)-a*omega2^2*cosd(theta2); a*alpha2*cosd(theta2)-a*omega2^2*sind(theta2)];
Ab=[Dddot;0];
R2=a*[cosd(theta2);sind(theta2)];
R12=-R2/2;
R32=R2/2;
R3=b*[cosd(theta3);sind(theta3)];
R23=R3/2;
R43=-R3/2;
rG2=a/2;
rG3=b/2;
A2=[-rG2*alpha2*sind(theta2)-rG2*omega2^2*cosd(theta2); ...
rG2*alpha2*cosd(theta2)-rG2*omega2^2*sind(theta2)];
Aa=[-a*alpha2*sind(theta2)-a*omega2^2*cosd(theta2); a*alpha2*cosd(theta2)-a*omega2^2*sind(theta2)];
Ag3a=[-rG3*alpha3*sind(theta3)-rG3*omega3^2*cosd(theta3);...
rG3*alpha3*cosd(theta3)-rG3*omega3^2*sind(theta3)];
A3=Aa-Ag3a;
A4=[Dddot;0];
A=[1 0 1 0 0 0 0 0
0 1 0 1 0 0 0 0
-R12(2) R12(1) -R32(2) R32(1) 0 0 0 1
0 0 -1 0 1 0 0 0
0 0 0 -1 0 1 0 0
0 0 R23(2) -R23(1) -R43(2) R43(1) 0 0
0 0 0 0 -1 0 m2 0
0 0 0 0 0 -1 1 0];
B=[m2*A2(1)
m2*A2(2)
I2*alpha2
m3*A3(1)
m3*A3(2)
I3*alpha3
m4*A4(1)-F(1)
-F(2)];
F=A\B
60.png
  5 Comments

Sign in to comment.

Categories

Find more on Simscape in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!