problems with plot3

16 次查看(过去 30 天)
Hey folks. I want to plot a function of two variables Resigma(d,omega). When i run matlab it gives me the error message:
Matrix dimensions must agree.
Error in mattisbardeen (line 20)
Resigma2 =
pi./8.*exp(-1./tau).*(cos(-d.*o)+sin(-d.*o)).*(omega+o)./omega.*((1+2.*Delta./(omega+o)).*L-(4.*Delta./(omega+o)).*F).*heaviside(omega+o-2.*Delta);
My code is (line 20 is where Realsigma2 is defined):
if true
clear
hbar = 6.582119e-01; % Planck constant (meV ps)
clf reset;
Delta = 1.0;
tau = 0.5;
o = 3./hbar;
omega0 = 0:1/100:2;
omega = 2:1/100:10;
d = 0:1/100:10;
k0 = 0;
k = (omega-2.*Delta)./(omega+2.*Delta);
l = (omega+o-2.*Delta)./(omega+o+2.*Delta);
[K,E] = ellipke(k);
[L,F] = ellipke(l);
Resigma1 = pi./8.*((1+2.*Delta./omega).*E-(4.*Delta./omega).*K).*heaviside(omega-2.*Delta);
Resigma2 = pi./8.*exp(-1./tau).*(cos(-d.*o)+sin(-d.*o)).*(omega+o)./omega.*((1+2.*Delta./(omega+o)).*L-(4.*Delta./(omega+o)).*F).*heaviside(omega+o-2.*Delta);
Resigma = Resigma1+Resigma2;
plot3(d,omega,Resigma,'b'); hold on
plot3(d,omega,k0,'b');
end
Plotting Resigma(d) and Resigma(omega) with plot for a fixed value of the other variable, respectively, both works. Any suggestions why I can't get the 3d plot? Thanks in advance!
  2 个评论
Star Strider
Star Strider 2018-7-4
The problem:
whos d omega
Name Size Bytes Class Attributes
d 1x1001 8008 double
omega 1x801 6408 double
You must decide how you want to solve that problem.
Rebecca Müller
Rebecca Müller 2018-7-4
what would be the possibilities..?

请先登录,再进行评论。

采纳的回答

Star Strider
Star Strider 2018-7-4
Try:
omega = linspace(2, 10, 200);
d = linspace(0, 10, 200);
Note that ‘k0’ is a scalar, and plot3 wants equal-length vectors.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by