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 Center および File ExchangeProgramming についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by