MATLAB不用科學計數法寫入資料至txt
阿新 • • 發佈:2020-08-13
dlmwrite(filename,file,'delimiter',',','newline','pc','precision','%.7f');
設定精度就不會將科學計數法的資料寫入到txt檔案中去。
matlab中保留有效位數
通過 vpa可以僅保留有效位數
vpaVariableprecisionarithmetic.
R=vpa(S)numericallyevaluateseachelementofthedoublematrix
SusingvariableprecisionfloatingpointarithmeticwithDdecimal
digitaccuracy,whereDisthecurrentsettingofDIGITS.
vpa(S,D)usesDdigits,insteadofthecurrentsettingofDIGITS.
DisanintegerortheSYMrepresentationofanumber.
Itisimportanttoavoidtheevaluationofanexpressionusingdouble
precisionfloatingpointarithmeticbeforeitispassedtovpa.
Forexample,
phi=vpa((1+sqrt(5))/2)
firstcomputesa16-digitapproximationtothegoldenratio,then
settingofDIGITS.Togetfullprecision,useunevaluatedstringor
symbolicarguments,
phi=vpa('(1+sqrt(5))/2')
or
s=sym('sqrt(5)')
phi=vpa((1+s)/2);
Additionalexamples:
vpa(pi,780)showssixconsecutive9'sneardigit770inthe
decimalexpansionofpi.
vpa(hilb(2),5)returns
[1.,.50000]
[.50000,.33333]