matlab程序中为什么下面这个式子运行不下去:f=zeros(2,1);f(1)=real(dptotal);f(2)=imag(dptotal);其中dptotal为复数程序提示是 In an assignment A(I) = B,the number of elements in BandI must be the same.
来源:学生作业帮助网 编辑:作业帮 时间:2024/06/21 06:24:49
![matlab程序中为什么下面这个式子运行不下去:f=zeros(2,1);f(1)=real(dptotal);f(2)=imag(dptotal);其中dptotal为复数程序提示是 In an assignment A(I) = B,the number of elements in BandI must be the same.](/uploads/image/z/8547275-11-5.jpg?t=matlab%E7%A8%8B%E5%BA%8F%E4%B8%AD%E4%B8%BA%E4%BB%80%E4%B9%88%E4%B8%8B%E9%9D%A2%E8%BF%99%E4%B8%AA%E5%BC%8F%E5%AD%90%E8%BF%90%E8%A1%8C%E4%B8%8D%E4%B8%8B%E5%8E%BB%EF%BC%9Af%3Dzeros%282%2C1%29%3Bf%281%29%3Dreal%28dptotal%29%3Bf%282%29%3Dimag%28dptotal%29%3B%E5%85%B6%E4%B8%ADdptotal%E4%B8%BA%E5%A4%8D%E6%95%B0%E7%A8%8B%E5%BA%8F%E6%8F%90%E7%A4%BA%E6%98%AF+In+an+assignment+A%28I%29+%3D+B%2Cthe+number+of+elements+in+BandI+must+be+the+same.)
matlab程序中为什么下面这个式子运行不下去:f=zeros(2,1);f(1)=real(dptotal);f(2)=imag(dptotal);其中dptotal为复数程序提示是 In an assignment A(I) = B,the number of elements in BandI must be the same.
matlab程序中为什么下面这个式子运行不下去:
f=zeros(2,1);
f(1)=real(dptotal);
f(2)=imag(dptotal);
其中dptotal为复数
程序提示是 In an assignment A(I) = B,the number of elements in B
and
I must be the same.
matlab程序中为什么下面这个式子运行不下去:f=zeros(2,1);f(1)=real(dptotal);f(2)=imag(dptotal);其中dptotal为复数程序提示是 In an assignment A(I) = B,the number of elements in BandI must be the same.
>> a=randint(1,3,[1 5]);
>> b=randint(1,3,[1 5]);
>> dptotal=complex(a,b)
dptotal =
5.0000 + 5.0000i 5.0000 + 1.0000i 3.0000 + 2.0000i>> f(1)=real(dptotal)
>> f(1)=real(dptotal)
? In an assignment A(I) = B, the number of elements in B and
I must be the same.
%%%可以看出f的尺寸和real(dptotal)的尺寸不一致
>> f(1,:)=real(dptotal)
f =
5 5 3
>> f(2,:)=imag(dptotal)
f =
5 5 3
5 1 2