MATLAB: Please help fixing the code

integralsyms

I need to plot an integral function n over 1.1 to Etop and it is keep saying there are too many inputs. I think I am not using syms function properly. Please help.
Etop = linspace(1.1, 1.4, 1000);
syms E; n = int(sqrt(E-1.1)/(1+exp((E-.86)/.2586)), 1.1, Etop, 'IgnoreSpecialCases', true)
figure plot(Etop, log(.558*n)) xlabel('Etop (eV)') ylabel('log(n) (cm^-3)')

Best Answer

  • variant 1
    xtop = linspace(1.1, 1.4, 1000)';
    y = arrayfun(@(i1)quad(@(x)sqrt(x-1.1)./(1+exp((x-.86)/.2586)),1.1,i1),xtop);
    figure, plot(xtop, log(.558*y)), xlabel('Etop (eV)'), ylabel('log(n) (cm^-3)')