您好,我想请教您,怎样从matlab 解中选出实数解?比如:Tr =0.77228493644506 2.29637079197834 + 0.81359047535945i2.29637079197834 - 0.81359047535945i0.23872873865694 + 1.29144736741090i0.23872873865694 - 1.29144736741090i我用了Tr=rea
来源:学生作业帮助网 编辑:作业帮 时间:2024/08/25 23:08:48
![您好,我想请教您,怎样从matlab 解中选出实数解?比如:Tr =0.77228493644506 2.29637079197834 + 0.81359047535945i2.29637079197834 - 0.81359047535945i0.23872873865694 + 1.29144736741090i0.23872873865694 - 1.29144736741090i我用了Tr=rea](/uploads/image/z/14937163-43-3.jpg?t=%E6%82%A8%E5%A5%BD%2C%E6%88%91%E6%83%B3%E8%AF%B7%E6%95%99%E6%82%A8%2C%E6%80%8E%E6%A0%B7%E4%BB%8Ematlab+%E8%A7%A3%E4%B8%AD%E9%80%89%E5%87%BA%E5%AE%9E%E6%95%B0%E8%A7%A3%3F%E6%AF%94%E5%A6%82%EF%BC%9ATr+%3D0.77228493644506+2.29637079197834+%2B+0.81359047535945i2.29637079197834+-+0.81359047535945i0.23872873865694+%2B+1.29144736741090i0.23872873865694+-+1.29144736741090i%E6%88%91%E7%94%A8%E4%BA%86Tr%3Drea)
您好,我想请教您,怎样从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