Hi,
I'm trying to evaluate a 1D integral, but every time I execute my code I get an error, which I've been unable to fix so far. I would appreciate if someone could help me correct it. I've been stuck at this point for some time.
Segment of Main Program (experiment.m):
359: fun2 = @(ksi)bstilde(ksi,ii,alpha,kappa,k_0,x1,x2,L_s,E_0);
360: bs_tilde(s,ii) = quad(fun2,0,1);
(here, ksi, ii, alpha,kappa,k_0,x1,x2,L_s,E_0 are all well defined. I've included the line numbers by hand)
Segment of bstilde function:
3: function f = bstilde(ksi,m,alpha,kappa,k_0,x1,x2,L_s,E_0)
5: N = ksi;
6: if (m == 1)
7: N = 1ksi;
8: end
10: J = complex(0.,1.);
11: x = (1ksi).*x1 + ksi.*x2;
12: f = alpha*(J*k_0 + 0.5*kappa  J*k_0*kappa.*x)*N.*L_s*E_0*exp(J*k_0.*x);
Now, when I execute this, I get the following error:
??? Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> bstilde at 12
f = alpha*(J*k_0 + 0.5*kappa  J*k_0*kappa.*x)*N.*L_s*E_0*exp(J*k_0.*x);
Error in ==> @(ksi)bstilde(ksi,ii,alpha,kappa,k_0,x1,x2,L_s,E_0)
Error in ==> quad at 77
y = f(x, varargin{:});
Error in ==> experiment at 360
bs_tilde(s,ii) = quad(fun2,0,1);
Eagerly awaiting a response. Thanks in advance!
Vivek
