problems with plot3

16 views (last 30 days)
Rebecca Müller
Rebecca Müller on 4 Jul 2018
Commented: Star Strider on 4 Jul 2018
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 Comments
Star Strider
Star Strider on 4 Jul 2018
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 on 4 Jul 2018
what would be the possibilities..?

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 4 Jul 2018
Try:
omega = linspace(2, 10, 200);
d = linspace(0, 10, 200);
Note that ‘k0’ is a scalar, and plot3 wants equal-length vectors.
  2 Comments
Rebecca Müller
Rebecca Müller on 4 Jul 2018
thanks!
Star Strider
Star Strider on 4 Jul 2018
As always, my pleasure!

Sign in to comment.

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!