Transforming 4 sets of 1x4 matrix into a 4x4 matrix

11 次查看(过去 30 天)
Hi... Can someone help and suggest a way how I can transform the answer to the solution which is a 4 set of 1x4 matrix to a 4x4 matrix.
clc;
T=253.2;
k12=0.1012;
m1=2.8149;
m2=2.0729;
sigma1=3.7169;
sigma2=2.7852;
E1=285.69;
E2=169.21;
k=1.38064852*10^-23;
d1=sigma1*(1-0.12*exp(-3*E1/T));
d2=sigma2*(1-0.12*exp(-3*E2/T));
X1=[0.1999 0.3997 0.5993 0.8002];
X2=[0.8001 0.6003 0.4007 0.1998]; %X2=1-X1
mbarliq=X1.*m1+X2.*m2;
etaassumedliq=[0.5 0.5 0.5 0.5];
etaliq=etaassumedliq;
rholiq=((6.*etaliq)./pi).*((X1.*m1.*d1.^3)+(X2.*m2.*d2^3)).^-1;
zetaliq=0;
for j=1:4
zetaliq=(pi/6).*rholiq.*(X1.*m1.*d1^(j-1)+X2.*m2.*d2^(j-1))
end
Below is the result from the above code:
However I would like it to be in the form of a 4x4 matrix such as below:
zetaliq=
x x x x
x x x x
x x x x
x x x x
Would appreciate the help. Thanks!

采纳的回答

KSSV
KSSV 2021-10-17
zetaliq=zeros(4);
for j=1:4
zetaliq(j,:)=(pi/6).*rholiq.*(X1.*m1.*d1^(j-1)+X2.*m2.*d2^(j-1)) ;
end
zetaliq

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by