+ 5

Matlab c/c++ question

As you see in the code the last part is repeated as 70,0,0 How to substitute all these following variables without writing each time as 70,0,0 d2=simplify(subs(d2,{b2u, b2v, b2w, a2x, a2y, a2z, L2, alf, bet, gam},{30,18,0,70,-41,-100,105,70,0,0})) c3z=B3_A(3,1)-sqrt(L3^2-(B3_A(1,1)-a3x)^2-(B3_A(2,1)-a3y)^2); d3=c3z-a3z d3=simplify(subs(d3,{b3u, b3v, b3w, a3x, a3y, a3z, L3, alf, bet, gam},{-30,18,0,0,81,-100,105,70,0,0})) d3=double(d3) d2=double(d2) c1z=B1_A(3,1)-sqrt(L1^2-(B1_A(1,1)-a1x)^2-(B1_A(2,1)-a1y)^2); d1=c1z-a1z d1=simplify(subs(d1,{b1u, b1v, b1w, a1x, a1y, a1z, L1, alf, bet, gam},{0,-35,0,-70,-41,-100,105,70,0,0})) d1=double(d1) c1z=simplify(subs(c1z,{b1u, b1v, b1w, a1x, a1y, a1z, L1, alf, bet, gam},{0,-35,0,-70,-41,-100,105,70,0,0})) c1z=double(c1z) c2z=simplify(subs(c2z,{b2u, b2v, b2w, a2x, a2y, a2z, L2, alf, bet, gam},{30,18,0,70,-41,-100,105,70,0,0})) c2z=double(c2z) c3z=simplify(subs(c3z,{b3u, b3v, b3w, a3x, a3y, a3z, L3, alf, bet, gam},{-30,18,0,0,81,-100,105,70,0,0})) c3z=double(c3z) R_AB=simplify(subs(R_AB,{b3u, b3v, b3w, a3x, a3y, a3z, L3, alf, bet, gam},{-30,18,0,0,81,-100,105,70,0,0})) B3_A=simplify(subs(B3_A,{b3u, b3v, b3w, a3x, a3y, a3z, L3, alf, bet, gam},{-30,18,0,0,81,-100,105,70,0,0})) B2_A=simplify(subs(B2_A,{b2u, b2v, b2w, a2x, a2y, a2z, L2, alf, bet, gam},{30,18,0,70,-41,-100,105,70,0,0})) B1_A=simplify(subs(B1_A,{b1u, b1v, b1w, a1x, a1y, a1z, L1, alf, bet, gam},{0,-35,0,-70,-41,-100,105,70,0,0}))

10th Aug 2019, 6:00 AM
Zhenis Otarbay
Zhenis Otarbay - avatar
1 Odpowiedź
+ 2
% define constant cell A={30,18,0,70,-41,-100,105,70,0,0}; %% d2=simplify(subs(d2,{b2u, b2v, b2w, a2x, a2y, a2z, L2, alf, bet, gam},A));
10th Aug 2019, 11:36 PM
Yacine Bouali