Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Hello, I am new and trying to plot the imaginary parts of a function, can anyone help?

1 回表示 (過去 30 日間)
Chris
Chris 2014 年 11 月 26 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hello, I am trying to plot the imaginary parts of Kz against Kx from the equation:-
Kz^2 = 8c sin^2(DKx/2)[2c sin^2(DKx/2) - lambdaq0^2]
which i have written as
Kz = sqrt ( 8 .* c .* ( sin ( ( D .* Kx ) ./ 2 ) ) .^2 .* ( 2 .* c .* ( ( sin ( ( D .* Kx) ./ 2 ) ) .^2 ) - ( lambda .* ( q0.^2 ) ) ) )
where lambda, D, q0 and c are all constants.
and really, I have no idea where to start, can anyone help me?

回答 (2 件)

Orion
Orion 2014 年 11 月 26 日
Hi,
all the functions you need are here

Chris
Chris 2014 年 11 月 26 日
Hello, thanks for the quick reply. Let us assume that I am completely inept at using matlab and my code looks like this:-
"clear variables
Kx = linspace(0,6*pi,300); D = 2.6 * 10^-9; lambda = 0.5 ; c = 0.5; q0 = 0.01 ;
Kz = sqrt ( 8 .* c .* ( sin ( ( D .* Kx ) ./ 2 ) ) .^2 .* ( 2 .* c .* ( ( sin ( ( D .* Kx) ./ 2 ) ) .^2 ) - ( lambda .* ( q0.^2 ) ) ) );
imag_Kz = imag(Kz);
figure (1) plot (Kx, imag_Kz)"
Does much of this seem wrong?
  1 件のコメント
Orion
Orion 2014 年 11 月 26 日
Your code is fine.
you really are plotting the imaginary part of Kz against Kx.
Note : when you post some code here, use the button {}Code to format it and make it more readable.

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by