Error using horzcat Dimensions of matrices being concatenated are not consistent.

1 view (last 30 days)
I want to find value of r for corresponding value of OG. but I am not able to get output. I recieved" Error using horzcat Dimensions of matrices being concatenated are not consistent". How to solve this problem. PLz help
clc
clear all
close all
W=[];
format shortG
syms AX0 OG
E=0;
ET=sqrt(-1);
A11 = 17.8*10^10;
A33 = 18.43*10^10;
A13 = 7.59*10^10;
A56 = 1.89*10^10;
A55 = 4.357*10^10;
A66 = 4.42*10^10;
A65 = 1.99*10^10;
B77 = 0.278*10^9;
B66 = 0.268*10^9;
AJ= 0.196;
RO=1.74*10^3;
K1 =A56-A55;
K2 = A66-A56;
CHI =K2-K1 ;
OG=[2:2:10];
for h=1:length(OG)
NON(h)=CHI*E.*OG(h);
NA55(h)=A55-NON(h);
NA33(h)=A33-NON(h);
NB66(h)=B66-AJ*NON(h);
NA11(h)=A11-NON(h);
NA66(h)=A66-NON(h);
NB77(h)=B77-AJ*NON(h);
%AP1=(A13+A56)./NA55;
AP2(h)=NA11(h)./NA55(h);
AP3(h)=A33./NA55(h);
AP4(h)=NA66(h)./NA33(h);
AP44(h)=A33./NA33(h);
AP6(h)=(AJ*A33)./NB66(h);
AP7=K2/K1;
AP8(h)=(A13+A56)./NA33(h);
AP9(h)=NA11(h)./NA33(h);
%AP10=NA66./NA55;
%AP11=K1./NA55;
%AP12=A65./NA55;
AP23=NA55/K1;
AP24=NA11./K1;
AP25=A33/K1;
AP26=(A13+A56)/K2;
AP27(h)=NA55(h)./NA33(h);
CHK(h)=(AJ*AX0*A33)./OG(h);
AP5(h)=(NB77(h)+CHK(h))./NB66(h);
AP30(h)=sqrt(CHK(h)./CHI); %value of 1/k
AP31(h)=1./AP30(h); %value of k
B1OKS(h)=AP2(h)-AP3(h).*AX0;
B2OKS(h)=AP4(h)-AP44(h).*AX0;
B3OKS(h)=AP5(h)-AP6(h).*AX0;
BLOKS(h,:)=([B1OKS(h);B2OKS(h);B3OKS(h)]);
BLOK(h,:)=[sqrt(B1OKS(h));sqrt(B2OKS(h));sqrt(B3OKS(h))];
BLOKC(h,:)=(BLOK(h,:)).^3;
for z=1:3
%
AZT(h,z)=ET*BLOK(h,z)./AP7; % value of xi
ANT(h,z)=AP26.*BLOK(h,z);% value of eta/k
A(h,z)=ET*A13-BLOK(h,z).*AZT(h,z)*A33;
B(h,z)=ET*AZT(h,z)*A56-BLOK(h,z)*A55+K1*ANT(h,z);
C(h,z)=-BLOK(h,z).*ANT(h,z).*AP31(h)*B66;
end
AU(AX0)= A(:,1).*B(:,2).*C(:,3)-A(:,1).*B(:,3).*C(:,2)-A(:,2).*B(:,1).*C(:,3)+A(:,2).*B(:,3).*C(:,1)+A(:,3).*B(:,1).*C(:,2)-A(:,3).*B(:,2).*C(:,1);
r=(double(solve(AU(AX0))));
W=[W r]
end

Accepted Answer

Torsten
Torsten on 30 May 2021
Edited: Torsten on 30 May 2021
Substitute OG at the end into the equation:
OGnum = 2:2:10;
W = [];
for i=1:numel(OGnum)
AUU = subs(AU,OG,OGnum(i));
r = solve(AUU==0,AX0)
W = [W,r]; % or maybe W = [W;r];
end

More Answers (0)

Community Treasure Hunt

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

Start Hunting!