How to use a Struct defined in previous calculation
Show older comments
Hello thanks for your time,
I am solving equations for the forces on this arm construction.

I calculate all the forces which occur on the upper arm by letting the angle (alpha) of the upper arm go from 0 to 90. This gives me for every set of equations a struct which contains some forces for every angle. For example like this:
F=100 %[N]
hoekF=50
alpha=[1:1:90]
r=20
x=20.574
[hoeksup]=zeros(1,90)
for i=1:90
hoeksup(i)=asind((3*sind(135-alpha(i)))/(sqrt((x^2)+(3^2)-(2*x*3*cosd(135-alpha(i))))))
end
Z=6
Y=(3*cosd(45))/2
syms F1x F1y F2
eqn1=(F*cosd(hoekF))==F1x+(F2.*cosd(alpha))
eqn2=(F*sind(hoekF))==F1y+(F2.*sind(alpha))
eqn3=(F2*cosd(alpha))*(3*sind(45))+(F2.*sind(alpha))*(3*cosd(45))+(F*sind(hoekF))*(Z)+(F*cosd(hoekF))*(Y)==0
for K = 1 : length(eqn1)
q(K) = (vpasolve([eqn1(K),eqn2(K),eqn3(K)], [F1x,F1y,F2]))
end
I then use for example [q.F1x] in the following calculations.
My problem is the following:
The lowest arm can also vary from 0 to 90 (theta) independently of the upper arm. So I have to calculate the forces for every angle of the bottom arm with the all the possible forces from the upper arm. I was able to calculate all the forces at the top of the bottom arm and put them on a plot. I did the following:
L1=6.243;
L2=2.0;
l1=2.1215;
theta=[1:1:90]
for i=1:90
syms F5 F6x F6y
eqn9=([c.F4x])+([d.F3x])==(F5.*cosd(theta(i)))+F6x+([d.Fp].*cosd(beta))
eqn10=([c.F4y])+([d.F3y])+(F5.*sind(theta(i)))+F6y==([d.Fp].*cosd(beta))
eqn11=(F5.*cosd(theta(i))*l1)+(F5.*sind(theta(i))*l1)+([d.F3y]*l1)+([d.Fp].*cosd(beta)*L1)==([d.F3x]*(L1-l1))+([c.F4x]*L1)
% eqn12=(F5.*cosd(theta)*(L1-l1))+(F6x*L1)==(F5.*sind(theta)*l1)+([d.F3x]*l1)+([d.F3y]*l1)
for K = 1 : length(eqn9)
e(K) = (vpasolve([eqn9(K),eqn10(K),eqn11(K)], [F5,F6x,F6y]))
end
plot(theta,[e.F5],'r')
hold on
end
This works for calculating all these forces (F5 F6x F6y) for every option of both angles, but I am unable to reuse all the calculated foces for calculations in lower parts of the bottom arm.
Is there a way to keep all the calculated structs e and use them later on?
gamma=theta-hoeksup
syms F7x F7y
eqn12=([e.F5].*cosd(theta))+(Fp2.*cosd(gamma))==F7x
eqn13=([e.F5].*sind(theta))+(Fp2.*sind(gamma))==F7y
Accepted Answer
More Answers (0)
Categories
Find more on Symbolic Computations in MATLAB 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!