problems with plot3

조회 수: 16 (최근 30일)
Rebecca Müller
Rebecca Müller 2018년 7월 4일
댓글: Star Strider 2018년 7월 4일
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.
  댓글 수: 2
Rebecca Müller
Rebecca Müller 2018년 7월 4일
thanks!
Star Strider
Star Strider 2018년 7월 4일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (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