Values Stored in Matrix not showing all decimals
Afficher commentaires plus anciens
Hi Everyone,
I'm having truble working with matrices, I'm doing a calculation which gives me results with a lot of d decimal places.
I want to store all the results in a matrix. Everything is working except that the values are somehow rounded up when stored in the matrix.
How do I change this?
Here is the example, it may be helpfull.
%DATA INPUT
format long;
syms D d C1 w Re C2 mnorm;
D = 0.11;
d = 0.04192;
C1 = 1;
rho = 997.8;
dpw = 99000;
mu = 9.972E-4;
C = [];
beta = d / D;
Ad = d^2*pi/4;
AD = D^2*pi/4;
mnorm = C1/sqrt(1-beta^4)*Ad*sqrt(2*dpw*rho);
w = mnorm/(AD*rho);
Re = (rho * w * D)/(mu);
C2 = 0.99 - 0.2262*beta^4.1-(0.00175*beta^2-0.0033*beta^4.15)*(10^6/Re)^1.15;
for i = 1:4
i;
mnorm1 = double(subs(mnorm,C1,C2));
w1 = double(subs(w,mnorm,mnorm1));
Re1 = double(subs(Re,w,w1));
C3 = double(subs(C2,Re,Re1));
B = [mnorm1, w1, Re1, C3];
C(i,:) = B;
end
Thanks a lot!
2 commentaires
Jan
le 27 Avr 2022
Which matrix do you mean? C? Of course the values are rounded by the double() command. The format of doubles contains about 16 digits.
What does "with a lot of decimals" mean? Of course the calculations produce results with an infinite number of decimals. It is clear, that they cannot be displayed, because this would require infinite resources.
SamuLibero
le 28 Avr 2022
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!