您好,我想请教您,怎样从matlab 解中选出实数解?比如:Tr =0.77228493644506 2.29637079197834 + 0.81359047535945i2.29637079197834 - 0.81359047535945i0.23872873865694 + 1.29144736741090i0.23872873865694 - 1.29144736741090i我用了Tr=rea
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/27 00:00:22
您好,我想请教您,怎样从matlab 解中选出实数解?比如:Tr =0.77228493644506 2.29637079197834 + 0.81359047535945i2.29637079197834 - 0.81359047535945i0.23872873865694 + 1.29144736741090i0.23872873865694 - 1.29144736741090i我用了Tr=rea
您好,我想请教您,怎样从matlab 解中选出实数解?
比如:Tr =
0.77228493644506
2.29637079197834 + 0.81359047535945i
2.29637079197834 - 0.81359047535945i
0.23872873865694 + 1.29144736741090i
0.23872873865694 - 1.29144736741090i
我用了Tr=real(Tr)
得到Tr =
2.29637079197834
0.23872873865694
2.29637079197834
0.23872873865694
0.77228493644506
问题是我只想得到其中的实数解,而不是实数根部?
您好,我想请教您,怎样从matlab 解中选出实数解?比如:Tr =0.77228493644506 2.29637079197834 + 0.81359047535945i2.29637079197834 - 0.81359047535945i0.23872873865694 + 1.29144736741090i0.23872873865694 - 1.29144736741090i我用了Tr=rea
可以通过观察,取出你想要的那个,比如这个Tr的第一个元素是实数,你可以用Tr(1)得到,也可以编写一段程序逐个判断,把是实数的放在一个新的数组中.
比如这个
n=length(Tr);
y=[];
for k=1:n
if isreal(Tr(k))==1
y(k)=Tr(k);
end
end
Tr=y