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/11/22 15:30:06
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