我尝试了如下所示的代码,它与装有Matlab 2017a版本的朋友PC完美配合。我也有相同版本的Matlab。每当我尝试在PC上编码时,都会显示错误:syms not defined
。
clear all
close all
clc
% here py = py/p0 and px = px/p0 and e = np0
% g = 0.01;
a = 4*pi/3;
%g = 0.15;
%a = 8*pi/5;
g = [0 0.01 0.1 0.75];
%n = -0.1:0.1:0.1;
syms px py
C = sqrt((px-1)^2 + py^2 - n.^2);
K = sqrt((px+1)^2 + py^2 - n.^2);
y = sqrt(1-g).*(n.*(C - K) +2*px*py ) + sin(a).*(K*(px-1) + C*(px + 1)) -cos(a).*(2*n.*px + (C - K)*py);
%sols = solve(y == 0,px)
fimplicit(y) % it gives the perfect plots in Matlab R2017b but i have R2016a then how i can plot with Matlab R2016a
axis([-3 3 -1 15])
任何人都可以弄清楚,此问题的原因是什么?。
使用ezplot可能就是您想要的。对于n的一个值和g的一个值,您可以执行以下操作:
clear all
close all
clc
%% Fermi arc formation with Energy not equal to zero.
% here py = py/p0 and px = px/p0 and e = np0
% g = 0.01;
a = 4*pi/3;
%g = 0.15;
%a = 8*pi/5;
g = 0.01;
n = 0.1;
syms px py
C = sqrt((px-1)^2 + py^2 - n.^2); % here i have just replaced hC by C
K = sqrt((px+1)^2 + py^2 - n.^2); % here i have just replaced hK by K
y = sqrt(1-g).*(n.*(C - K) +2*px*py ) + sin(a).*(K*(px-1) + C*(px + 1)) - cos(a).*(2*n.*px + (C - K)*py);
%sols = solve(y == 0,px)
ezplot(y) % it gives the perfect plots in Matlab R2017b but i have R2016a then how i can plot with Matlab R2016a
axis([-3 3 -1 15])