how to solve "Error using alpha. Too many output arguments."
Afficher commentaires plus anciens
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
Réponses (1)
KALYAN ACHARJYA
le 29 Nov 2019
Modifié(e) : KALYAN ACHARJYA
le 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

5 commentaires
Sencer Comert
le 29 Nov 2019
Modifié(e) : KALYAN ACHARJYA
le 29 Nov 2019
KALYAN ACHARJYA
le 29 Nov 2019
Modifié(e) : KALYAN ACHARJYA
le 29 Nov 2019
%
a=3;
b=13;
c=0;
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
mu=0;
%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 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
% For 2 rev, plot torqe T12, pin force F12, pin force F32, pin force F43 on same graph as function of theta2
THETA2=0:1:360;
for i=1:1:length(THETA2)
theta2=THETA2(i);
theta3=asind((-a*sind(theta2)+c)/b)+180;
omega3=a*omega2*cosd(theta2)/(b*cosd(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];
g=32.2;
W2=1;
W3=2;
W4=4;
mu=0.4;
m2=W2/g;
m3=W3/g;
m4=W4/g;
I2=0.02;
I3=0.8;
F=[-1000;-500];
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;
T21(i)=-F(8);
f12(i)=norm([F(1);F(2)]);
f32(i)=norm([F(3);F(4)]);
f43(i)=norm([F(5);F(6)]);
end
plot(THETA2,T21,THETA2,f12,THETA2,f32,THETA2,f43)
grid minor
legend('T21','F12','F32','F43')
legend('Location','north')
set(gcf,'Visible','on')
grid minor

Sencer Comert
le 29 Nov 2019
KALYAN ACHARJYA
le 29 Nov 2019
Please copy my answer (code) and execute it
Sencer Comert
le 29 Nov 2019
Catégories
En savoir plus sur Simscape dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!