Error in multiplying corresponding matrix elements
1 view (last 30 days)
Show older comments
hello friends,
I am trying to multiply coresponding matrix elements using (.*)
but I faced an error as:
Unrecognized function or variable 'A1_m'.
Error in MyCode (line 106)
Alka= A1_m.*ka_m;
MyCode is:
% Parameters:% % Based on the layers properties.%
k1 = 0.25; k2 = 0.5; k3 = 0.2; k21= k2/k1; k32= k3/k2;
Lx = 40e-03;
Ly = 40e-03;
Lz1 = 0.08e-03; Lz2 = 2e-03; Lz3 = 10e-03;
a1 = 5.79e-08; a2 = 1.23e-07; a3 = 6.67e-08;
w1 = 0; w2 = 101; w3 = 137;
%Tb= ; Tts= ; Tini= ;
mu1= 80e+03 ; mu2= 2.4e+03 ; mu3= 1e+03 ;
qmet1= 368.1 ; qmet2= 367.1 ; qmet3= 368.1 ;
n=1;
m=1;
b1 = (n*pi/Lx)^2;
b2 = (n*pi/Lx)^2;
b3 = (n*pi/Lx)^2;
g1 = (m*pi/Ly)^2;
g2 = (m*pi/Ly)^2;
g3 = (m*pi/Ly)^2;
% Solving the Equations and Crating Solved Variable Matrix: %
% As a result of dependence of values of b1, b2, b3 and g1, g1, g3 on the
% n,m values, the equations should be solved for every n, m values separetely.
% For any n, m values a set of solution for s1,s2,s3,s21,s32 is achieved.
% So matrixes are defined for collecting all solutions together.
ss1= zeros(10, 10);
ss2= zeros(10, 10);
ss3= zeros(10, 10);
ss21= zeros(10, 10);
ss32= zeros(10, 10);
for n=1:10
for m=1:10
fhandle= @(X)fsolve_t(X,n,m);
X0= [120 12 100 0.1 8];
X = fsolve( fhandle, X0);
ss1(n,m)=X(1);
ss2(n,m)=X(2);
ss3(n,m)=X(3);
ss21(n,m)=X(4);
ss32(n,m)=X(5);
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Equation Coefficients in a Matrix:
A1= zeros(10,10);
B1= zeros(10,10);
A2= zeros(10,10);
B2= zeros(10,10);
A3= zeros(10,10);
B3= zeros(10,10);
for n=1:10
for m=1:10
A1= ones(n,m); % Assumptions for Simplification
B1= zeros(n,m); % for h=0 since B1(n,m)= (1/(k1*ss1(n,m)))*h*A1(n,m)
A2(n,m)= A1(n,m)*cos(ss1(n,m)*Lz1)+ B1(n,m)*sin(ss1(n,m)*Lz1);
B2(n,m)= (1/(k21*ss21(n,m)))*(-A1(n,m)*sin(ss1(n,m)*Lz1)+ B1(n,m)*cos(ss1(n,m)*Lz1));
A3(n,m)= A2(n,m)*cos(ss2(n,m)*Lz2)+ B2(n,m)*sin(ss2(n,m)*Lz2);
B3(n,m)= (1/(k32*ss32(n,m)))*(-A2(n,m)*sin(Lz2*ss2(n,m))+ B2(n,m)*cos(ss2(n,m)*Lz2));
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% what should I do for n, m????
XI= (1- (-1)^n)/ sqrt(b1); % For every non-isolated layer: XI_i= int(sin (beta_i*x), 0, Lx)
YI= (1- (-1)^m)/ sqrt(g1); % For every non-isolated layer: YI_i= int(sin (gamma_i*y), 0, Ly)
ZI1_i1= A1(n,m)*sin(ss1(n,m)*Lz1)/ss1(n,m)-B1(n,m)*cos(ss1(n,m)*Lz1)/ss1(n,m)+B1(n,m)/ss1(n,m); % For every layer: ZI1_i= int(Ai*cos(s_i*z)+Bi*sin(s_i*z), 0, Lzi)
ZI1_i2= A2(n,m)*sin(ss2(n,m)*Lz2)/ss2(n,m)-B2(n,m)*cos(ss2(n,m)*Lz2)/ss2(n,m)+B2(n,m)/ss2(n,m);
ZI1_i3= A3(n,m)*sin(ss3(n,m)*Lz3)/ss3(n,m)-B3(n,m)*cos(ss3(n,m)*Lz3)/ss3(n,m)+B3(n,m)/ss3(n,m);
ZIl_m= [ZI1_i1 ZI1_i2 ZI1_i3];
Al_i1= (A1(n,m)^2 + B1(n,m)^2 )*Lz1/2+(A1(n,m)*B1(n,m)*(sin(ss1(n,m)*Lz1))^2/ss1(n,m))+(A1(n,m)^2-B1(n,m)^2)*sin(2*ss1(n,m)*Lz1)/(4*ss1(n,m)); % For every layer: Al_i= int((Ai*cos(s_i*z)+Bi*sin(s_i*z))^2, 0, Lzi)
Al_i2= (A2(n,m)^2 + B2(n,m)^2 )*Lz2/2+(A2(n,m)*B2(n,m)*(sin(ss2(n,m)*Lz2))^2/ss2(n,m))+(A2(n,m)^2-B2(n,m)^2)*sin(2*ss2(n,m)*Lz2)/(4*ss2(n,m));
Al_i3= (A3(n,m)^2 + B3(n,m)^2 )*Lz3/2+(A3(n,m)*B3(n,m)*(sin(ss3(n,m)*Lz3))^2/ss3(n,m))+(A3(n,m)^2-B3(n,m)^2)*sin(2*ss3(n,m)*Lz3)/(4*ss3(n,m));
Al_m= [Al_i1 Al_i2 Al_i3];
ka_m= [k1/a1 k2/a2 k3/a3];
Alka= A1_m.*ka_m;
Al= sum(Alka); % Al= sigma(ki/ai)*Al_i
What should I do now??
I appreciate any kind of suggestions.
3 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Resizing and Reshaping Matrices 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!