solve symbol four equations for c1 c2 c3 c4

11 views (last 30 days)
how can I solve these four equations for c1 c2 c3 c4
syms c1 c2 c3 c4 a b
T1=c1+c2*a+c3*b+c4*a*b;
T2=c1-c2*a+c3*b-c4*a*b;
T3=c1-c2*a-c3*b+c4*a*b;
T4=c1+c2*a-c3*b-c4*a*b;

Accepted Answer

jannat alsaidi
jannat alsaidi on 15 Nov 2019
Thanks, I solve it,
clc
clear
syms a b x y c1 c2 c3 c4 T1 T2 T3 T4
T=c1+c2*x+c3*y+c4*x*y;
%%
r1=c1+c2*a+c3*b+c4*a*b-T1;
r2=c1-c2*a+c3*b-c4*a*b-T2;
r3=c1-c2*a-c3*b+c4*a*b-T3;
r4=c1+c2*a-c3*b-c4*a*b-T4;
%%Find C1 and C4
p13=r1+r3;
p24=r2+r4;
n1=solve(p13==0,c1);
n2=solve(p24==0,c1);
C4=solve(n1==n2,c4)
w1=solve(p13==0,c4);
w2=solve(p24==0,c4);
C1=solve(w1==w2,c1)
r1=subs(r1,c1,C1);
r1=subs(r1,c4,C4);
r2=subs(r2,c1,C1);
r2=subs(r2,c4,C4);
r3=subs(r3,c1,C1);
r3=subs(r3,c4,C4);
r4=subs(r4,c1,C1);
r4=subs(r4,c4,C4);
%%Find C3
q12=r1+r2;
q34=r3+r4;
C3=solve(q12==0,c3)
r1=subs(r1,c3,C3);
r2=subs(r2,c3,C3);
r3=subs(r3,c3,C3);
r4=subs(r4,c3,C3);
%% find C2
C2=solve(r1==0,c2)
r1=subs(r1,c2,C2);
r2=subs(r2,c2,C2);
r3=subs(r3,c2,C2);
r4=subs(r4,c2,C2);
C1
C2
C3
C4

More Answers (1)

KALYAN ACHARJYA
KALYAN ACHARJYA on 15 Nov 2019
Edited: KALYAN ACHARJYA on 15 Nov 2019
solve here
  1 Comment
jannat alsaidi
jannat alsaidi on 15 Nov 2019
it does not worked with me
syms c1 c2 c3 c4 a b r1 r2 r3 r4
T1=c1+c2*a+c3*b+c4*a*b;
T2=c1-c2*a+c3*b-c4*a*b;
T3=c1-c2*a-c3*b+c4*a*b;
T4=c1+c2*a-c3*b-c4*a*b;
eqns=[T1==r1; T2==r2; T3==r3; T4==r4 ]
[c1 c2 c3 c4]=solve(eqns,[c1 c2 c3 c4])

Sign in to comment.

Categories

Find more on Symbolic Math Toolbox 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!