Error using quad (line 70)

4 ビュー (過去 30 日間)
Maedeh Mashhadbani
Maedeh Mashhadbani 2020 年 11 月 16 日
コメント済み: Maedeh Mashhadbani 2020 年 11 月 16 日
i write this code for value V=0 i see this error
clc; clear all;
n=10; t=-2.66; E0=0; eta=15*10^(-2); KbT=0.0258; Ef=0;
alphag=1; alphad=0.5; Vg=0; U=0; j=0; phi=0; a0=1.42; a=1; b=1;
sigmaR=zeros(6,6);
sigmaL=zeros(6,6);
%E=-10:2*10/n:10;
kx=-pi/(3*a0); %:pi*2/(3*a0*100):pi/(3*a0)
%a=exp(-i*kx*a0/2);
%b=exp(i*kx*a0);
V=0;
syms E;
UL=0;
%UL=-(alphag*Vg)-(alphad*V(l));
mu1=Ef;
mu2=Ef-V;
Hc=[E+i*eta-E0 -b*t 0 -a*t 0 0;-b'*t E+i*eta-E0 -a'*t 0 0 0; 0 -a*t E+i*eta-E0 0 0 -a*t; -a'*t 0 0 E+i*eta-E0 -a'*t 0; 0 0 0 -a*t E+i*eta-E0 -b*t; 0 0 -a'*t 0 -b'*t E+i*eta-E0];
sigmaR(3,3)=(-t)*exp(i*kx*a0);
sigmaL(4,4)=(-t)*exp(i*kx*a0);
gamaR=i*(sigmaR-sigmaR');
gamaL=i*(sigmaL-sigmaL');
Gc=inv(Hc-sigmaR-sigmaL);
T=trace(gamaR*Gc*gamaL*Gc');
f1=1./(1+exp((E+UL-mu1)));
f2=1./(1+exp((E+UL-mu2)));
I=T.*(f1-f2);
current=quad(vectorize(I),-10,10)
Error using quad (line 70)
The integrand function must return an output vector of the same length as the input vector.
Error in test (line 26)
current=quad(vectorize(I),-10,10)
  2 件のコメント
John D'Errico
John D'Errico 2020 年 11 月 16 日
編集済み: John D'Errico 2020 年 11 月 16 日
What is I?
I
I =
0
I is a scalar. It is not even a function. The last time I checked, the integral of 0 over pretty much any interval you want is still ero. As for why you are using the old quad code, I have no idea, but even quad would be able to integrate it, if you actually provided a function.
A numerical integration tool must be passed a FUNCTION. Not a scalar, ot even a vector. If that is what you wanted to do, then use trapz or cumtrapz.
Maedeh Mashhadbani
Maedeh Mashhadbani 2020 年 11 月 16 日
i used int but it didnt work i try quad and it workes i dont know why int didnt work

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeNumerical Integration and Differentiation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by