using meshgrid data in a matrix
3 views (last 30 days)
Show older comments
mohammad mortezaie
on 29 May 2020
Commented: mohammad mortezaie
on 29 May 2020
I tried to use a meshgrid data in a matrix and then evalute eigenvalues. but i faced to "Dimensions of arrays being concatenated are not consistent." error can simeone help me?
my code is:
iform=complex(0.0,1.0);
g_k=2.*t1_tilda.*exp(-iform.*k_x.*a1x).*cos(k_y.*b/2)+t2_tilda.*exp(iform.*k_x.*a2x)+2.*t3_tilda.*exp(iform.*k_x.*a3x).*cos(k_y.*b/2)+t5_tilda.*exp(-iform.*k_x.*a5x);
f_k=4.*t4_tilda.*cos(k_x.*a/2).*cos(k_y.*b/2);
eps1=0:0.01:2;
eps2=0:0.01:2;
[e1,e2]=meshgrid(eps1,eps2);
H=[f_k+e1 g_k;conj(g_k) f_k+e1];
E=eig(H);
landa2=E(1);
landa1=E(2);
EG=landa2-landa1;
contour(e1,e2,EG,10000)
2 Comments
Accepted Answer
KSSV
on 29 May 2020
YOu should modify these lines:
eps1=0:0.01:2;
eps2=0:0.01:2;
[e1,e2]=meshgrid(eps1,eps2);
I hope that g_k, f_k are of same dimensions.
[m,n] = size(f_k) ;
eps1 = linspace(0,2,n) ;
eps2 = linspace(0,2,m) ;
[e1,e2] = meshgrid(eps1,eps2) ;
3 Comments
KSSV
on 29 May 2020
EG are Eigen values..it will be an array. You cannot use it to plot contour lines. To plot contour lines EG should be a matrix. You can try using diag(EG). But what exactly you want?
More Answers (0)
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!