Reputation: 743
I keep getting a matrix dimension error, although i pay attention to the array operators from the below code. As I am not willing to strictly perform matrix operations could someone explain the origin of the dimension / size issue?
Thanks
Error using .* Matrix dimensions must agree
% integrand behaviour
f=@(k) k .* exp(-k);
x=0.5;
al=1;
bet=0.89;
theta0=(1/al) .*atan(bet .*tan(pi*al/2));
c=exp(-(pi .* x) ./2 * bet);
c2=1 /(2.*abs(bet));
v1=@(theta) 2/pi .* ((pi/2 + bet.*theta)/cos(theta)) .* exp(1/bet .* (pi/2 +
bet.*theta)...
.* tan(theta));
g=@(theta) c .* v1(theta);
y=@(theta) f(g(theta)) ; % values of integrand
a=[-pi/2:0.2:pi/2]';
Y=y(a);
plot(a,Y)
Upvotes: 0
Views: 39
Reputation: 733
The source of your problem is here:
(pi/2 + bet.*theta)/cos(theta)
You use the /
operator, where I think that you mean to use the ./
operator.
Upvotes: 1