绘制复杂的隐式方程

时间:2018-03-30 17:49:51

标签: matlab

我想在py / p0和px / p0之间绘制下面的给定等式

 g = 0.15;    % i have used g intead of gamma
 a = 8*pi/5;    % I have used 'a' insted of alpha in coding
 E = 0.1*p0;

 %% Introducing the elliptic coordinate for
  % This is an optional way to plot.

 % px = p0*cosh(u)*cos(v);
 % py = p0*sinh(u)*sin(v);

 hC = sqrt((px-p0)^2 + py^2 - E^2);  
 hK = sqrt((px+p0)^2 + py^2 - E^2);

 sqrt(1-g)*(E*(hC - hK) +2*px*py ) + sin(a)*(hK*(px-p0) + hC*(px + p0)) -cos(a)*(2*E*px + (hC - hK)*py);  


  % My main aims is to Plot above equation either we use elliptic coordinate or not.

我尝试了如下所示的代码,它与Matlab R2017b完美配合,但我没有这个版本的matlab,我有Matlab R2016a,我想在R2016a中绘制它。

 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 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);   % 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)
 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])

1 个答案:

答案 0 :(得分:1)

使用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])