i'm having issues using format short in my code
41 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I want to limit the number of decimal points my outputs have for an entire code section. I tried using "format short" at the top of my section, but find that my outputs at the end of calculations have 30+ digits attached. The values are correct, i just want to pare them down without having to use the vpa command on every one.
2 comentarios
Respuestas (1)
Cris LaPierre
el 18 de Nov. de 2021
syms t
digits(4)
E = 9000; %MPa
v = 0.36;
t = 152e-5;
I = eye(3);
F = t*[.1 -.171 0;
.063 .062 0;
0 -.045 -.149];
Ft = transpose(F);
strain = .5*(F+Ft);
rotation = .5*(F-Ft);
epskk = sum(diag(strain));
delta = 0;
for i = 1:length(strain)
for j = 1:length(strain)
if i==j
delta = 1;
else
delta = 0;
end
sig(i,j) = (E/(1+v))*(strain(i,j) + (v/(1-2*v))*epskk*delta);
end
disp(sig)
end
sigt = transpose(sig);
n = [0.8 -0.6 0];
nt = transpose(n);
T = sigt*nt;
signn = dot(T,n); %this is in MPa
T_normal = signn*nt
T_shear = T-T_normal
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!