function [x,y,z,alpha]=eq4variable(aaaa1,bbbb1,dddd1,eeee1,cccc1,aaaa2,bbbb2,dddd2,eeee2,cccc2,aaaa3,bbbb3,dddd3,eeee3,cccc3,aaaa4,bbbb4,dddd4,eeee4,cccc4)
var1=[aaaa1,bbbb1,dddd1,cccc1]
var2=[aaaa2,bbbb2,dddd2,cccc2]
var3=[aaaa3,bbbb3,dddd3,cccc3]
var3=[aaaa4,bbbb4,dddd4,cccc4]
%solving equation
%reassigning values to convert equation into 3 variable
aaa1=aaaa1*eeee2;
bbb1=bbbb1*eeee2;
ccc1=cccc1*eeee2;
ddd1=dddd1*eeee2;
eee1=eeee1*eeee2;
aaa2=aaaa2*eeee1;
bbb2=bbbb2*eeee1;
ccc2=cccc2*eeee1;
ddd2=dddd2*eeee1;
eee2=eeee2*eeee1;
%Subtracting equation1 and equation2
PPP1=aaa1-aaa2;
RRR1=bbb1-bbb2;
SSS1=ddd1-ddd2;
TTT1=eee1-eee2;
QQQ1=ccc1-ccc2;
%reassigning values to convert equation into 3 variable
aaa3=aaaa3*eeee4;
bbb3=bbbb3*eeee4;
ccc3=cccc3*eeee4;
ddd3=dddd3*eeee4;
eee3=eeee3*eeee4;
aaa4=aaaa4*eeee3;
bbb4=bbbb4*eeee3;
ccc4=cccc4*eeee3;
ddd4=dddd4*eeee3;
eee4=eeee4*eeee3;
%Subtracting equation3 and equation4
PPP2=aaa3-aaa4;
RRR2=bbb3-bbb4;
SSS2=ddd3-ddd4;
TTT2=eee3-eee4;
QQQ2=ccc3-ccc4;
%reassigning values to convert equation into 3 variable
aaa5=aaaa1*eeee4;
bbb5=bbbb1*eeee4;
ccc5=cccc1*eeee4;
ddd5=dddd1*eeee4;
eee5=eeee1*eeee4;
aaat6=aaaa4*eeee1;
bbb6=bbbb4*eeee1;
ccc6=cccc4*eeee1;
ddd6=dddd4*eeee1;
eee6=eeee4*eeee1;
%Subtracting equation1 and equation4
PPP3=aaa1-aaa4;
RRR3=bbb1-bbb4;
SSS3=ddd1-ddd4;
TTT3=eee1-eee4;
QQQ3=ccc1-ccc4;
[x,y,z]=eq3variable(PPP1,RRR1,SSS1,QQQ1,PPP2,RRR2,SSS2,QQQ2,PPP3,RRR3,SSS3,QQQ3)
alpha=(cccc1-(aaaa1*x)-(bbbb1*y)-(ccc1*z))/eeee1
end
Comments are written in green.
function and conditions are written in aqua blue.
Input arguments are highlighted by yellow color.
This code is not tested yet.....
var1=[aaaa1,bbbb1,dddd1,cccc1]
var2=[aaaa2,bbbb2,dddd2,cccc2]
var3=[aaaa3,bbbb3,dddd3,cccc3]
var3=[aaaa4,bbbb4,dddd4,cccc4]
%solving equation
%reassigning values to convert equation into 3 variable
aaa1=aaaa1*eeee2;
bbb1=bbbb1*eeee2;
ccc1=cccc1*eeee2;
ddd1=dddd1*eeee2;
eee1=eeee1*eeee2;
aaa2=aaaa2*eeee1;
bbb2=bbbb2*eeee1;
ccc2=cccc2*eeee1;
ddd2=dddd2*eeee1;
eee2=eeee2*eeee1;
%Subtracting equation1 and equation2
PPP1=aaa1-aaa2;
RRR1=bbb1-bbb2;
SSS1=ddd1-ddd2;
TTT1=eee1-eee2;
QQQ1=ccc1-ccc2;
%reassigning values to convert equation into 3 variable
aaa3=aaaa3*eeee4;
bbb3=bbbb3*eeee4;
ccc3=cccc3*eeee4;
ddd3=dddd3*eeee4;
eee3=eeee3*eeee4;
aaa4=aaaa4*eeee3;
bbb4=bbbb4*eeee3;
ccc4=cccc4*eeee3;
ddd4=dddd4*eeee3;
eee4=eeee4*eeee3;
%Subtracting equation3 and equation4
PPP2=aaa3-aaa4;
RRR2=bbb3-bbb4;
SSS2=ddd3-ddd4;
TTT2=eee3-eee4;
QQQ2=ccc3-ccc4;
%reassigning values to convert equation into 3 variable
aaa5=aaaa1*eeee4;
bbb5=bbbb1*eeee4;
ccc5=cccc1*eeee4;
ddd5=dddd1*eeee4;
eee5=eeee1*eeee4;
aaat6=aaaa4*eeee1;
bbb6=bbbb4*eeee1;
ccc6=cccc4*eeee1;
ddd6=dddd4*eeee1;
eee6=eeee4*eeee1;
%Subtracting equation1 and equation4
PPP3=aaa1-aaa4;
RRR3=bbb1-bbb4;
SSS3=ddd1-ddd4;
TTT3=eee1-eee4;
QQQ3=ccc1-ccc4;
[x,y,z]=eq3variable(PPP1,RRR1,SSS1,QQQ1,PPP2,RRR2,SSS2,QQQ2,PPP3,RRR3,SSS3,QQQ3)
alpha=(cccc1-(aaaa1*x)-(bbbb1*y)-(ccc1*z))/eeee1
end
For proper reading I had done some color changes:
Comments are written in green.
function and conditions are written in aqua blue.
Input arguments are highlighted by yellow color.
This code is not tested yet.....
No comments:
Post a Comment