Info
この質問は閉じられています。 編集または回答するには再度開いてください。
Warning: Imaginary parts of complex X and/or Y arguments ignored
1 回表示 (過去 30 日間)
古いコメントを表示
Hi Everybody,
I want to plot gp vs. q in the following code:
kab=3;
kba=3;
gp=0.0:0.0001:1.25;
gn=0.0:0.0001:1.25;
DeltaB=8.296;
H=((i*gp./2)-(i*gn./2))./((DeltaB./2)-i*gn./2);
q=sqrt(((DeltaB./2).^2-kab*kba-(DeltaB./2).*(i*gp./2+i*gn./2)-gp.*gn./4)./(1-H.*1));
T=10*log10((abs(q.*1)).^2./(abs((q.*cosh(-q.*i))+((DeltaB./2-i*gn./2).*sinh(-q.*i)))).^2.);
plot(gp,q,'r')
grid on
q has real and imaginary part, but I got only the real part, and the code said:
Warning: Imaginary parts of complex X and/or Y arguments ignored
Any help please
2 件のコメント
Walter Roberson
2012 年 7 月 17 日
Please re-tag this question. See http://www.mathworks.co.uk/matlabcentral/answers/43073-a-guide-to-tags
Jan
2012 年 7 月 17 日
Beside using meaningful tags (all questions concern Matlab here!), formatting your code would be helpful also: Answers: how-to-format-your-question-with-markup
回答 (2 件)
Wayne King
2012 年 7 月 17 日
What do you think you only have the real part?
kab=3;
kba=3;
gp=0.0:0.0001:1.25;
gn=0.0:0.0001:1.25;
DeltaB=8.296;
H=((i*gp./2)-(i*gn./2))./((DeltaB./2)-i*gn./2);
q=sqrt(((DeltaB./2).^2-kab*kba-(DeltaB./2).*(i*gp./2+i*gn./2)-gp.*gn./4)./(1-H.*1));
T=10*log10((abs(q.*1)).^2./(abs((q.*cosh(-q.*i))+((DeltaB./2-i*gn./2).*sinh(-q.*i)))).^2.);
plot(gp,real(q),'r')
You are using the unit imaginary, i, in both H and both q.
0 件のコメント
Walter Roberson
2012 年 8 月 10 日
Please re-tag this question. See http://www.mathworks.co.uk/matlabcentral/answers/43073-a-guide-to-tags
0 件のコメント
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!