From: Sarah Thompson on
Hey everybody

Im trying to integrate a function func1 but keep getting matrix errors I fixed the matrix must be square error and the Matrix dimensions must agree error but I cant figure out how to fix this one. The code im using is below:

Function code:
function [ f1 ] = func1( E, Delta, kB, Temp )
%func1: calculates integrand for eqn 1
% Detailed explanation goes here
f1=(tanh(sqrt(((E.*E)+(Delta.*Delta))))/(2.*kB.*Temp))/(2.*(sqrt(((E.*E)+(Delta.*Delta)))));
end

command line code:

debye=(Tdebye*kB1)/h;
Temp1=0.5;
Delta1=0;
a=hbar*fdebye;
>> Delta1=0.;
>> Q=quad(@(E1)func1(E1,0.,1.38065E-23,0.5),-a,a)
??? Index exceeds matrix dimensions.

Error in ==> quad at 85
if ~isfinite(y(7))

Thanks