While executing this program i am getting Error using symengine Operands are invalid. Error in sym/privBinaryOp (line 973) Csym = mupadmex(op,args{1}.s, args{2}.s, varargin{:}); Error in / (line 353) X = privBinaryOp(A, B, 'sy

1 view (last 30 days)
syms E
ec=1.6*10^(-19);
del= 1.3*10^(-3)*ec;
k= 1.3807*10^(-23);
T=1.5;
V= linspace(0,5);
i=int((abs(E))/(sqrt(E.^2-del.^2))*(1/(1+exp((E-ec.*V)/(k.*T))-1/(1+exp(E./(k.*T))))), E, -inf, -1*del)
+ int((abs(E))/(sqrt(E.^2-del.^2))*(1/(1+exp((E-ec.*V)/(k.*T))-1/(1+exp(E./(k.*T))))), E, del, inf);
plot(V,i);

Answers (2)

Ameer Hamza
Ameer Hamza on 28 Apr 2018
You are getting this error because you are dividing 1 by 1x100 sym array, by using / symbol. You need to use ./ notation for the element-wise division. Inside the int change
(1/(1+exp((E-ec.*V)/(k.*T))-1/(1+exp(E./(k.*T)))))
to
(1./(1+exp((E-ec.*V)/(k.*T))-1/(1+exp(E./(k.*T)))))

Walter Roberson
Walter Roberson on 28 Apr 2018
You are creating a vector of values. You need to use ./ instead of /
However, the left side of the addition, the integral from negative infinity, gives an infinite result for all V, and the right side of the addition, the integral to +infinity, gives 0 for all V.

Community Treasure Hunt

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

Start Hunting!