how I can delete 1.0e+03 in my answer

12 views (last 30 days)
Murad Alzahrani
Murad Alzahrani on 16 Jul 2019
Answered: Guillaume on 16 Jul 2019
clc;clear;
tf=10;
n=1;
dt=0.1;
t(n)=0.1;
G1(n)=1; G2(n)=0; G3(n)=-1; G4(n)=0;
m(n,:)=[1 0 -1 0];
while t(n)<=tf
t(n+1)=t(n)+dt;
m(n+1,:)=m(n,:)+slope(t(n),m(n,:))*dt;
n=n+1;
end
m
this is my code, but when I run it, it gives me like this
m =
1.0e+03 *
0.0010 0 -0.0010 0
0.0010 0.0001 -0.0010 -0.0001
0.0008 0.0002 -0.0009 -0.0002
0.0003 0.0003 -0.0007 -0.0003
-0.0005 0.0003 -0.0004 -0.0004
-0.0013 0.0003 -0.0001 -0.0004
-0.0020 0.0001 0.0002 -0.0004
-0.0026 -0.0001 0.0005 -0.0004
-0.0029 -0.0003 0.0007 -0.0003
-0.0027 -0.0006 0.0007 -0.0003
-0.0021 -0.0009 0.0005 -0.0002
-0.0009 -0.0011 0.0001 -0.0002
my question is how I can delete 1.0e+03 ? should the answer be like this
m =
1.0000 0 -1.0000 0
1.0000 0.1000 -1.0000 -0.1000
0.7500 0.2000 -0.9000 -0.2000
0.2500 0.2750 -0.7000 -0.2900
-0.4525 0.3000 -0.4175 -0.3600
-1.2625 0.2548 -0.0875 -0.4018
-2.0464 0.1285 0.2408 -0.4105
-2.6496 -0.0761 0.5103 -0.3864
Thank you

Answers (1)

Guillaume
Guillaume on 16 Jul 2019
format shortg
%or
format longg
should fix your display issue.

Community Treasure Hunt

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

Start Hunting!