MATLAB: Problems with plot3

MATLABplot3

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!

Best Answer

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