the cpoy and paste of matrix will change the rank?
1 次查看(过去 30 天)
显示 更早的评论
i use the following codes to get the matri of A ,
and the rank of A is 10,but when i copy the A and recalculate the rank of a,it runs out the 1,why?
codes are as this
omega=1.795200;
m0=7.234737;
m1=1.816835;
m2=5.349043;
m3=8.732933;
m4=12.024736;
m5=15.265388;
m6=18.476340;
m7=21.668910;
m8=24.849430;
m9=28.021668;
m10=31.187986;
syms a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 alpha0 alpha1 alpha2 alpha3 alpha4 alpha5 alpha6 alpha7 alpha8 alpha9;
h=22;
hgang=22;
agang=2.2497;
dgang= 21.1940;
a=agang/hgang;
d=dgang/hgang;
equation0=alpha0 == (2*a1*sin(d*m1)*besselk(1, a*m1))/(d*m1*(sin(2*m1)/(4*m1) + 1/2)^(1/2)) + (2*a2*sin(d*m2)*besselk(1, a*m2))/(d*m2*(sin(2*m2)/(4*m2) + 1/2)^(1/2)) + (2*a3*sin(d*m3)*besselk(1, a*m3))/(d*m3*(sin(2*m3)/(4*m3) + 1/2)^(1/2)) + (2*a4*sin(d*m4)*besselk(1, a*m4))/(d*m4*(sin(2*m4)/(4*m4) + 1/2)^(1/2)) + (2*a0*sinh(d*m0)*(besselj(1, a*m0) + bessely(1, a*m0)*i))/(d*m0*(sinh(2*m0)/(4*m0) + 1/2)^(1/2));
equation1=alpha1 == (2*a1*d*m1*sin(d*m1)*besselk(1, a*m1))/((sin(2*m1)/(4*m1) + 1/2)^(1/2)*(pi^2 - d^2*m1^2)) + (2*a2*d*m2*sin(d*m2)*besselk(1, a*m2))/((sin(2*m2)/(4*m2) + 1/2)^(1/2)*(pi^2 - d^2*m2^2)) + (2*a3*d*m3*sin(d*m3)*besselk(1, a*m3))/((sin(2*m3)/(4*m3) + 1/2)^(1/2)*(pi^2 - d^2*m3^2)) + (2*a4*d*m4*sin(d*m4)*besselk(1, a*m4))/((sin(2*m4)/(4*m4) + 1/2)^(1/2)*(pi^2 - d^2*m4^2)) - (2*a0*d*m0*sinh(d*m0)*(besselj(1, a*m0) + bessely(1, a*m0)*i))/((sinh(2*m0)/(4*m0) + 1/2)^(1/2)*(pi^2 + d^2*m0^2));
equation2=alpha2 == (2*a0*d*m0*sinh(d*m0)*(besselj(1, a*m0) + bessely(1, a*m0)*i))/((4*pi^2 + d^2*m0^2)*(sinh(2*m0)/(4*m0) + 1/2)^(1/2)) - (2*a2*d*m2*sin(d*m2)*besselk(1, a*m2))/((4*pi^2 - d^2*m2^2)*(sin(2*m2)/(4*m2) + 1/2)^(1/2)) - (2*a3*d*m3*sin(d*m3)*besselk(1, a*m3))/((4*pi^2 - d^2*m3^2)*(sin(2*m3)/(4*m3) + 1/2)^(1/2)) - (2*a4*d*m4*sin(d*m4)*besselk(1, a*m4))/((4*pi^2 - d^2*m4^2)*(sin(2*m4)/(4*m4) + 1/2)^(1/2)) - (2*a1*d*m1*sin(d*m1)*besselk(1, a*m1))/((4*pi^2 - d^2*m1^2)*(sin(2*m1)/(4*m1) + 1/2)^(1/2));
equation3=alpha3 == (2*a1*d*m1*sin(d*m1)*besselk(1, a*m1))/((9*pi^2 - d^2*m1^2)*(sin(2*m1)/(4*m1) + 1/2)^(1/2)) + (2*a2*d*m2*sin(d*m2)*besselk(1, a*m2))/((9*pi^2 - d^2*m2^2)*(sin(2*m2)/(4*m2) + 1/2)^(1/2)) + (2*a3*d*m3*sin(d*m3)*besselk(1, a*m3))/((9*pi^2 - d^2*m3^2)*(sin(2*m3)/(4*m3) + 1/2)^(1/2)) + (2*a4*d*m4*sin(d*m4)*besselk(1, a*m4))/((9*pi^2 - d^2*m4^2)*(sin(2*m4)/(4*m4) + 1/2)^(1/2)) - (2*a0*d*m0*sinh(d*m0)*(besselj(1, a*m0) + bessely(1, a*m0)*i))/((9*pi^2 + d^2*m0^2)*(sinh(2*m0)/(4*m0) + 1/2)^(1/2));
equation4=alpha4 == (2*a0*d*m0*sinh(d*m0)*(besselj(1, a*m0) + bessely(1, a*m0)*i))/((16*pi^2 + d^2*m0^2)*(sinh(2*m0)/(4*m0) + 1/2)^(1/2)) - (2*a2*d*m2*sin(d*m2)*besselk(1, a*m2))/((16*pi^2 - d^2*m2^2)*(sin(2*m2)/(4*m2) + 1/2)^(1/2)) - (2*a3*d*m3*sin(d*m3)*besselk(1, a*m3))/((16*pi^2 - d^2*m3^2)*(sin(2*m3)/(4*m3) + 1/2)^(1/2)) - (2*a4*d*m4*sin(d*m4)*besselk(1, a*m4))/((16*pi^2 - d^2*m4^2)*(sin(2*m4)/(4*m4) + 1/2)^(1/2)) - (2*a1*d*m1*sin(d*m1)*besselk(1, a*m1))/((16*pi^2 - d^2*m1^2)*(sin(2*m1)/(4*m1) + 1/2)^(1/2));
equation5=a0 == ((sinh(d*m0) - sinh(m0))/(m0*(sinh(2*m0)/(4*m0) + 1/2)^(1/2)) - (alpha0*sinh(d*m0))/(2*a*m0*(sinh(2*m0)/(4*m0) + 1/2)^(1/2)) + (pi*alpha1*d*m0*sinh(d*m0)*(besseli(2, a*m1) + besseli(1, a*m1)/(a*m1)))/(besseli(1, a*m1)*(sinh(2*m0)/(4*m0) + 1/2)^(1/2)*(pi^2 + d^2*m0^2)) - (2*pi*alpha2*d*m0*sinh(d*m0)*(besseli(2, a*m2) + besseli(1, a*m2)/(a*m2)))/((4*pi^2 + d^2*m0^2)*besseli(1, a*m2)*(sinh(2*m0)/(4*m0) + 1/2)^(1/2)) + (3*pi*alpha3*d*m0*sinh(d*m0)*(besseli(2, a*m3) + besseli(1, a*m3)/(a*m3)))/((9*pi^2 + d^2*m0^2)*besseli(1, a*m3)*(sinh(2*m0)/(4*m0) + 1/2)^(1/2)) - (4*pi*alpha4*d*m0*sinh(d*m0)*(besseli(2, a*m4) + besseli(1, a*m4)/(a*m4)))/((16*pi^2 + d^2*m0^2)*besseli(1, a*m4)*(sinh(2*m0)/(4*m0) + 1/2)^(1/2)))/(m0*(besselj(2, a*m0) + bessely(2, a*m0)*i - besselj(1, a*m0)/(a*m0) + (bessely(1, a*m0)*(-i))/(a*m0)));
equation6=a1 == ((sin(d*m1) - sin(m1))/(m1*(sin(2*m1)/(4*m1) + 1/2)^(1/2)) - (alpha0*sin(d*m1))/(2*a*m1*(sin(2*m1)/(4*m1) + 1/2)^(1/2)) - (pi*alpha1*d*m1*sin(d*m1)*(besseli(2, a*m1) + besseli(1, a*m1)/(a*m1)))/(besseli(1, a*m1)*(sin(2*m1)/(4*m1) + 1/2)^(1/2)*(pi^2 - d^2*m1^2)) + (2*pi*alpha2*d*m1*sin(d*m1)*(besseli(2, a*m2) + besseli(1, a*m2)/(a*m2)))/((4*pi^2 - d^2*m1^2)*besseli(1, a*m2)*(sin(2*m1)/(4*m1) + 1/2)^(1/2)) - (3*pi*alpha3*d*m1*sin(d*m1)*(besseli(2, a*m3) + besseli(1, a*m3)/(a*m3)))/((9*pi^2 - d^2*m1^2)*besseli(1, a*m3)*(sin(2*m1)/(4*m1) + 1/2)^(1/2)) + (4*pi*alpha4*d*m1*sin(d*m1)*(besseli(2, a*m4) + besseli(1, a*m4)/(a*m4)))/((16*pi^2 - d^2*m1^2)*besseli(1, a*m4)*(sin(2*m1)/(4*m1) + 1/2)^(1/2)))/(m1*(besselk(2, a*m1) - besselk(1, a*m1)/(a*m1)));
equation7=a2 == ((sin(d*m2) - sin(m2))/(m2*(sin(2*m2)/(4*m2) + 1/2)^(1/2)) - (alpha0*sin(d*m2))/(2*a*m2*(sin(2*m2)/(4*m2) + 1/2)^(1/2)) - (pi*alpha1*d*m2*sin(d*m2)*(besseli(2, a*m1) + besseli(1, a*m1)/(a*m1)))/(besseli(1, a*m1)*(sin(2*m2)/(4*m2) + 1/2)^(1/2)*(pi^2 - d^2*m2^2)) + (2*pi*alpha2*d*m2*sin(d*m2)*(besseli(2, a*m2) + besseli(1, a*m2)/(a*m2)))/((4*pi^2 - d^2*m2^2)*besseli(1, a*m2)*(sin(2*m2)/(4*m2) + 1/2)^(1/2)) - (3*pi*alpha3*d*m2*sin(d*m2)*(besseli(2, a*m3) + besseli(1, a*m3)/(a*m3)))/((9*pi^2 - d^2*m2^2)*besseli(1, a*m3)*(sin(2*m2)/(4*m2) + 1/2)^(1/2)) + (4*pi*alpha4*d*m2*sin(d*m2)*(besseli(2, a*m4) + besseli(1, a*m4)/(a*m4)))/((16*pi^2 - d^2*m2^2)*besseli(1, a*m4)*(sin(2*m2)/(4*m2) + 1/2)^(1/2)))/(m2*(besselk(2, a*m2) - besselk(1, a*m2)/(a*m2)));
equation8=a3 == ((sin(d*m3) - sin(m3))/(m3*(sin(2*m3)/(4*m3) + 1/2)^(1/2)) - (alpha0*sin(d*m3))/(2*a*m3*(sin(2*m3)/(4*m3) + 1/2)^(1/2)) - (pi*alpha1*d*m3*sin(d*m3)*(besseli(2, a*m1) + besseli(1, a*m1)/(a*m1)))/(besseli(1, a*m1)*(sin(2*m3)/(4*m3) + 1/2)^(1/2)*(pi^2 - d^2*m3^2)) + (2*pi*alpha2*d*m3*sin(d*m3)*(besseli(2, a*m2) + besseli(1, a*m2)/(a*m2)))/((4*pi^2 - d^2*m3^2)*besseli(1, a*m2)*(sin(2*m3)/(4*m3) + 1/2)^(1/2)) - (3*pi*alpha3*d*m3*sin(d*m3)*(besseli(2, a*m3) + besseli(1, a*m3)/(a*m3)))/((9*pi^2 - d^2*m3^2)*besseli(1, a*m3)*(sin(2*m3)/(4*m3) + 1/2)^(1/2)) + (4*pi*alpha4*d*m3*sin(d*m3)*(besseli(2, a*m4) + besseli(1, a*m4)/(a*m4)))/((16*pi^2 - d^2*m3^2)*besseli(1, a*m4)*(sin(2*m3)/(4*m3) + 1/2)^(1/2)))/(m3*(besselk(2, a*m3) - besselk(1, a*m3)/(a*m3)));
equation9=a4 == ((sin(d*m4) - sin(m4))/(m4*(sin(2*m4)/(4*m4) + 1/2)^(1/2)) - (alpha0*sin(d*m4))/(2*a*m4*(sin(2*m4)/(4*m4) + 1/2)^(1/2)) - (pi*alpha1*d*m4*sin(d*m4)*(besseli(2, a*m1) + besseli(1, a*m1)/(a*m1)))/(besseli(1, a*m1)*(sin(2*m4)/(4*m4) + 1/2)^(1/2)*(pi^2 - d^2*m4^2)) + (2*pi*alpha2*d*m4*sin(d*m4)*(besseli(2, a*m2) + besseli(1, a*m2)/(a*m2)))/((4*pi^2 - d^2*m4^2)*besseli(1, a*m2)*(sin(2*m4)/(4*m4) + 1/2)^(1/2)) - (3*pi*alpha3*d*m4*sin(d*m4)*(besseli(2, a*m3) + besseli(1, a*m3)/(a*m3)))/((9*pi^2 - d^2*m4^2)*besseli(1, a*m3)*(sin(2*m4)/(4*m4) + 1/2)^(1/2)) + (4*pi*alpha4*d*m4*sin(d*m4)*(besseli(2, a*m4) + besseli(1, a*m4)/(a*m4)))/((16*pi^2 - d^2*m4^2)*besseli(1, a*m4)*(sin(2*m4)/(4*m4) + 1/2)^(1/2)))/(m4*(besselk(2, a*m4) - besselk(1, a*m4)/(a*m4)));
[A, b] = equationsToMatrix([equation0, equation1, equation2,equation3,equation4,equation5,equation6, equation7, equation8,equation9], [a0, a1, a2 ,a3, a4 , alpha0 ,alpha1 ,alpha2 ,alpha3 ,alpha4]);
and the rank( A) is 10,
but when i copt the matrix A and calculate the rank of A,it get out the 1,why?
A =...
...
[ - 14547186153589216317120976241525/50328715046552884871112366751744 - (11067376412618097943977112897985*i)/12582178761638221217778091687936, 10045566870117554386053609892956350802656748920209/41815826252695678451841357052067724394233067470848 + (38212912330913546333933271927439582529157556319393*i)/52269782815869598064801696315084655492791334338560, - 10045566870117554386053609892956350802656748920209/62999744934768208151332428452243698833687383638016 - (38212912330913546333933271927439582529157556319393*i)/78749681168460260189165535565304623542109229547520, 1435080981445364912293372841850907257522392702887/14043753724507969458302419437250801878643960184832 + (126953197112669589149279973180862400429094871493*i)/408248654782208414485535448757290752286161633280, - 10045566870117554386053609892956350802656748920209/147735419663058348367521255509111564279802006339584 - (38212912330913546333933271927439582529157556319393*i)/184669274578822935459401569386389455349752507924480, 1, 0, 0, 0, 0]
[ -296349324225323643384292415563/33639933814238323125075836928, -8129216622937086741211209072144761934456574976889/2050170152471208841565167065708702466276170137600, 2709738874312362247070403024048253978152191658963/3656343846794279512703106531818576750862758051840, -8129216622937086741211209072144761934456574976889/25833800520235551318614639869755705905233233182720, 8129216622937086741211209072144761934456574976889/46644477092029352456507624838042939650496381583360, 0, 1, 0, 0, 0]
[ 13522588663836194993980917796725/17631211176203321124428655362048, -3452062385466744459959884618289904701226396322167/2828023964629027589888871736420775202197262565376, -3452062385466744459959884618289904701226396322167/2190653302455404848074155102501142206346409541632, 3497530279094979189422375499787137488577909141/10694139224177094924916120683256758406712655872, -3452062385466744459959884618289904701226396322167/22265362370793135938565296299199059821039682846720, 0, 0, 1, 0, 0]
[ -1559505055508291766081383701859/7325920830152149842646987177984, 40622780053623480499550084142509355499320739442737/164219357544379496541994966008429797107988168704000, -40622780053623480499550084142509355499320739442737/84389506161396227241690508417791717252379181056000, -40622780053623480499550084142509355499320739442737/48660246143575895230895222155200124072170094592000, 40622780053623480499550084142509355499320739442737/234929899370536863903683924455284018633792028672000, 0, 0, 0, 1, 0]
[ 145838977485677560441873737143/1698523909862782370727849885696, -5230845433647037967648954968353982549043744360977/56440789552437185617852909254801587025922228224000, 5230845433647037967648954968353982549043744360977/42998930339625539910443664973947233039634399232000, -15692536300941113902946864905061947647131233082931/61787494954818384222206472262308220955596423168000, -5230845433647037967648954968353982549043744360977/10768506511621049891271613404731891137384546304000, 0, 0, 0, 0, 1]
[ 1, 0, 0, 0, 0, - 19215206817301820201937645933374036236042240/312547901147939322718983515605629276594765441 - (6768960512610041956879930131725477048483840*i)/34727544571993258079887057289514364066085049, 311822173964424859837463003136/4182101353199550343907676068867, -32758260305221388623706849280/507157969485712932497800171043, 1074690585838732255773514006528/17714189487407758346830959806935, -4217261388076414059818656989184/66954719808397516799363753130003]
[ 0, 1, 0, 0, 0, pi*(144059190304636750863338087835057724199218497968354586295107797/2446196724593975793015010125110610682116089828997016170381967360 + (114182725422888477127721339727956710052886909222178814898704217*i)/611549181148493948253752531277652670529022457249254042595491840), (6373987289404659872595495466573082135095775602773*pi)/164792814120371931452773292525785545285435769487360, (1866902816615813251928194064653293767800945463*pi)/15757081295075041034691086819326489962244734976, -(5155874420064302306074166750515442461692706494419*pi)/63455452499346924584569286752621495539451559936000, (13929477699905966940085900270602586319233983248593*pi)/177769867492423376011634069286936746537615622144000]
[ 0, 0, 1, 0, 0, pi*(- 9464989338576010663641040107852943348161756038187711210495130309/334786751097527661443341868614963494529183647077160847702082191360 - (7502043267713731825867055861261399052044045856414964256985623049*i)/83696687774381915360835467153740873632295911769290211925520547840), -(359647875850784208474461056105259465318300911317*pi)/68783230572620007852236149854508416087444800143360, (1491280192527213932355605863890205848162693411339*pi)/13480422184672866986284910016233667451715615457280, (124803259942280896090021788864765346762906143405079*pi)/1091330405129737807036538042638191289801382035456000, -(337177379549110141775193947667076009201637100775613*pi)/4532584749598244496474862383717467767011759095808000]
[ 0, 0, 0, 1, 0, pi*(15646162213207041479098502059587806306703894195417071959648052421/846030272049793392224269349451262918787793849710511133560980635648 + (12401301438212310647408758642027689291628507785318486157217897481*i)/211507568012448348056067337362815729696948462427627783390245158912), (9936948082441062162015806310171888189711714626463*pi)/4384959577658516572786543633942597099272009024536576, -(5282508055207274506629691783028660420071424958195*pi)/225403800818533532313654072351950733940600273371136, (1403447897422781626477159087055068774733031825133*pi)/6932660975349988900289667134781792796272492544000, (3791654838227565187249719560444373602394912477551*pi)/23918033291036642220972615444403915409124753408000]
[ 0, 0, 0, 0, 1, pi*(- 96850311095890057474600622066292417300526063865839919947163193497/7149692360286571710357404675869855841740536003322368113589050408960 - (76764505309227784444080920316982007181254868855370344850327591917*i)/1787423090071642927589351168967463960435134000830592028397262602240), -(2278150693781893501965631214056678334135659812033*pi)/1648966467348438933504394877733030378029235977584640, (726642584284646511025523077002058332515134227547*pi)/59417389819028630748491999550292796349374886051840, -(182435260226832054739117358996020969042983792915701*pi)/3952585887016323880807243202099537361549452640256000, (492880097916447269765789180295077779652228882159047*pi)/1476790770714909314421347029553103020708755144704000]
and also when i use the
fprintf('A=%s;',char(A))
to print A and get that the rank of A is 1,how queer.
0 个评论
采纳的回答
Walter Roberson
2019-5-18
When you copy and paste
- 14547186153589216317120976241525/50328715046552884871112366751744 - (11067376412618097943977112897985*i)/12582178761638221217778091687936
then those are evaluated as double precision numbers.
14547186153589216317120976241525 approximates as 14547186153589216981797711118336
50328715046552884871112366751744 approximates as itself
11067376412618097943977112897985 approximates as 11067376412618098658996614332416
12582178761638221217778091687936 approximates as itself
With the numerators in the real and imaginary parts both being approximated, it is not uncommon that the rank of the matrix will change.
Remember, just because you can get the Symbolic Toolbox to output a long integer does not mean that regular MATLAB can work with numbers those long without losing precision.
- sym('14547186153589216317120976241525')/sym('50328715046552884871112366751744') - (sym('11067376412618097943977112897985')*i)/sym('12582178761638221217778091687936')
4 个评论
Walter Roberson
2019-5-18
A =...
...
[1 2 3]
The assigment ends after that line.
[4 5 6]
There is no assignment happening, and there is no semi-colon, so a vector is built and the result is displayed.
[7 8 10];
There is no assignment happening, and there is a semi-colon on the end of the line, so a vector is built and the result is discarded.
Assignment continues automatically on to a new line under any of three different circumstances:
- The active part of the line ends in ... When that happens, the rest of that line is discarded, and the result is as if the next line was there in place of the ... with the line break being ignored . [123 ... line-break 456] is the same as [123 456] not the same as [123; 456]
- there is an active [ that has not been balanced by a ] . When that happens, unless the line ended with ... then the line is treated as-if it ended with ;... so [123 line-break 456] is treated the same as [123 ;... line-break 456] which is the same as [123; 456]
- there is an active { that has not been balanced by a } . When that happens, unless the line ended with ... then the line is treated as-if it ended with ;... so {123 line-break 456} is treated the same as {123 ;... line-break 456} which is the same as {123; 456}
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!