Create matrix from columns of variable (a)-for loop
古いコメントを表示
Hi I want to create a matrix TA from the columns EE generated in the last loop. I can display the wanted columns "disp (EE)' but when adding the matrix want to create from these columns, an error occurred, noted that the vectors/columns EE has a variable (a)
You may ignore the lines of the code before the line start with C = [I;A;B]; for getting the question
I=ones(20,2);
for i=0:20
theta=(pi/40)*i;
r=2.5;x1=r*cos(theta);
y1=r*sin(theta);s=i+1;
I(s,:)=[x1,y1];
end
A=ones(20,2);
for k=1:20
r=(k-1)/10;
A(k,:)=[1,r];
end
m=1:-(1/47):0;
B=ones(length(m),2);
B(:,1)=m';B(:,2)=2;
C = [I;A;B];
%%find the complex variable matrix, ZC connjgate Z
Z=ones(length(C),1);
for v=1:length(C)
Z(v)=C(v,1)+1i*C(v,2);end
ZC=conj(Z);
F=ones(89,2);syms Fb;
for ii=1:89
if ii<22
F(ii,1)=0;F(ii,2)=0;
elseif ii<42
F(ii,1)=1; F(ii,2)=0;
else
F(ii,1)=(89-ii)/(89-42);F(ii,2)=0;
end
end
FF=F.*Fb;
zzc=Z-ZC;
QQ=ones(length(Z),21);SS=ones(length(Z),21);ss=0;
T1=ones(length(Z),21);T2=ones(length(Z),21);syms a
for K=-6:14
ss=ss+1;
QQ(:,ss)=Z.^(2*K-1)+ZC.^(2*K-1);
SS(:,ss)=(2*ss-1)*(Z.^(2*ss-2));
T1(:,ss)=Z.^(2*K-2);T2(:,ss)=ZC.^(2*K-2);
end
%multiplying the T1,T2 BY THE FCTOR
Q=QQ.';S=SS.';
TA=ones(89,21);TB=ones(89,21);
Tz=sqrt(Z.^2-a^2); Tzc=sqrt(ZC.^2-a^2);
for j=1:21
CC=Tz.*T1(:,j);DD=Tzc.*T2(:,j);EE=CC+DD;
TA(:,j)=EE;
end
採用された回答
その他の回答 (2 件)
Wazy sky
2018 年 10 月 11 日
編集済み: Walter Roberson
2018 年 10 月 11 日
2 件のコメント
Walter Roberson
2018 年 10 月 11 日
If you dbstop at the vpasolve() and examine vpa(EmE) then you will see that it has a large number of real constants times real() or imag() of various variables, added together, with no obvious cross-products or exponentiation or exp() or the like. So each row is linear in real() and imag() of those variables. But each row also ends in a constant that has both a real and an imaginary coefficient. With all of those constants being real valued, and with real() and imag() also returning real-valued information, then the part involving the variables must be real-valued. That means there is no possibility of part of a term canceling out the imaginary part of the constant coefficient of the row. Therefore the rows cannot equal 0, because although you might balance the real portion, you are left with a non-zero imaginary portion.
Wazy sky
2018 年 10 月 12 日
Wazy sky
2018 年 10 月 13 日
カテゴリ
ヘルプ センター および File Exchange で Conversion Between Symbolic and Numeric についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!