How can I eliminate numbers with "e" in the transfer function and show them in their long form?

1 vue (au cours des 30 derniers jours)
gam=0.5;
N=10;
wb=0.01;
wh=100;
if round(gam)==gam, G10=tf('s')^gam;
else,
k=1:N; wu=sqrt(wh/wb);
wkp=wb*wu.^((2*k-1-gam)/N); wk=wb*wu.^((2*k-1+gam)/N);
G10=zpk(-wkp,-wk,wh^gam); G10=tf(G10)
end
G10 =
10 s^10 + 832.6 s^9 + 1.974e04 s^8 + 1.672e05 s^7 + 5.416e05 s^6 + 6.859e05 s^5
+ 3.417e05 s^4 + 6.657e04 s^3 + 4958 s^2 + 132 s + 1
--------------------------------------------------------------------------------------
s^10 + 132 s^9 + 4958 s^8 + 6.657e04 s^7 + 3.417e05 s^6 + 6.859e05 s^5 + 5.416e05 s^4
+ 1.672e05 s^3 + 1.974e04 s^2 + 832.6 s + 10
Continuous-time transfer function.
I have a code as above and the result is as above. In my transfer function, I don't want to numbers like 1.974e04, 1.672e05, 5.416e05, 6.859e05 to appear as ''e'' and I want to show them in their long form. Can you help me?

Réponse acceptée

Paul
Paul le 24 Oct 2020
If you don't mind me asking, why do you want to display G10 with coefficients in their long form?
If you just want to seem them in any of the standard Matlab formats (long, short e, etc) you can always use the num and den properties, e.g.,
G10.num{:}

Plus de réponses (1)

Walter Roberson
Walter Roberson le 24 Oct 2020
Edit toolbox/shared/controllib/engine/+ltipack/@tfdata/dispsys.m . Save a copy of the original file because you will want to fix the code back to the original after you see what the results of your requirements look like in practice.
Look at approximately line 145 inside local function poly2str and change
form = '%.4g';
to whatever format you would prefer, such as '%.4f'.
If you use a %f format, then for example
>> sprintf('%.4f', 6.645e20)
ans =
'664500000000000000000.0000'
but remember then that
>> sprintf('%.4f', 6.645e-20)
ans =
'0.0000'
I would suggest that for your purposes, the best format would be '%.324f' . If using an 'e' format is not acceptable, then %.324f is the minimum width format that permits you to reliably distinguish between all possible numeric values including eps(realmin) and 2*eps(realmin)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by