I need to organize my OM3 OM4 and AP3 AP4 into a table for each of their values. I cant figure out how to insert and more than just one of each value but need both.

1 回表示 (過去 30 日間)
clear
clc
close all
%%Given Information
L1=[100 6];
L2=[40 2];
L3=[120 7];
L4=[80 9];
theta_2=[40 30];%theta2 in degrees
OC=[2 2];%1 for open 2 for closed
rp=[0 6];
d_a=[0 30];%delta angle in degrees
OM2=[25 10];%omega2 in rad/2
AP2=[15 0];%alpha 2 in rad/2^2
theta2=theta_2*(pi/180);%convert theta 2 to rad
da=d_a*(pi/180);%convert delta to rad
x_size=2;
%%Calculations
for i = 1:x_size
K1(i)=L1(i)/L2(i);
K2(i)=L1(i)/L4(i);
K3(i)=(L2(i)^2-L3(i)^2+L4(i)^2+L1(i)^2)/(2*L2(i)*L4(i));
K4(i)=L1(i)/L3(i);
K5(i)=(L4(i)^2-L1(i)^2-L2(i)^2-L3(i)^2)/(2*L2(i)*L3(i));
A(i)=cos(theta2(i))-K1(i)-K2(i)*cos(theta2(i))+K3(i);
B(i)=-2*sin(theta2(i));
C(i)=K1(i)-(K2(i)+1)*cos(theta2(i))+K3(i);
D(i)=cos(theta2(i))-K1(i)+K4(i)*cos(theta2(i))+K5(i);
E(i)=-2*sin(theta2(i));
F(i)=K1(i)+(K4(i)-1)*cos(theta2(i))+K5(i);
end
if OC==1
theta_4(i)=2*atand((-B(i)-(B(i)^2-4*A(i)*C(i))^(1/2))/(2*A(i)));%theta4 for open in deg
theta_3(i)=2*atand((-E(i)-(E(i)^2-4*D(i)*F(i))^(1/2))/(2*D(i)));%theta3 for open in deg
else
theta_4(i)=2*atand((-B(i)+(B(i)^2-4*A(i)*C(i))^(1/2))/(2*A(i)));%theta4 for crossed in deg
theta_3(i)=2*atand((-E(i)+(E(i)^2-4*D(i)*F(i))^(1/2))/(2*D(i)));%theta3 for crossed in deg
end
theta4(i)=theta_4(i)*(pi/180);%convert theta4 to rad
theta3(i)=theta_3(i)*(pi/180);%convert theta3 to rad
OM3(i)=((L2(i)*OM2(i))/L3(i))*((sin(theta4(i)-theta2(i)))/(sin(theta3(i)-theta4(i))));
OM4(i)=((L2(i)*OM2(i))/L4(i))*((sin(theta2(i)-theta3(i)))/(sin(theta4(i)-theta3(i))));
Aa(i)=L4(i)*sin(theta4(i));
Ba(i)=L3(i)*sin(theta3(i));
Ca(i)=L2(i)*AP2(i)*sin(theta2(i))+L2(i)*(OM2(i))^2*cos(theta2(i))+L3(i)*(OM3(i))^2*cos(theta3(i))-L4(i)*(OM4(i))^2*cos(theta4(i));
Da(i)=L4(i)*cos(theta4(i));
Ea(i)=L3(i)*cos(theta3(i));
Fa(i)=L2(i)*AP2(i)*cos(theta2(i))-L2(i)*(OM2(i))^2*sin(theta2(i))-L3(i)*(OM3(i))^2*sin(theta3(i))+L4(i)*(OM4(i))^2*sin(theta4(i));
AP3(i)=((Ca(i)*Da(i)-Aa(i)*Fa(i))/(Aa(i)*Ea(i)-Ba(i)*Da(i)));
AP4(i)=((Ca(i)*Ea(i)-Ba(i)*Fa(i))/(Aa(i)*Ea(i)-Ba(i)*Da(i)));
%%Table
Values=['Omega 3','Alpha 3','Omega 4','Alpha 4'];
OM3(i)=[OM3(i)];
AP3(i)=[AP3(i)];
OM4(i)=[OM4(i)];
AP4(i)=[AP4(i)];
mltable=table(OM3(i),AP3(i),OM4(i),AP4(i))

回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by