How do I make the values appear in the table?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
n=zeros(1,20);
for i=1:20
n(i)=1*10^i;
end
% Calculate (1+1/n)^n evaulated for all the above n's
approx=zeros(1,20);
approx=(1+1./n).^n;
% The actual e(on computer, it's the floating point approximation)
e=ones(1,20)*exp(1);
% Fourth column is the absolute error
abs_error=abs(e-approx);
% Fifth column is the relative error
rel_error=abs_error/exp(1);
table(n,approx,e,abs_error,rel_error)
0 Kommentare
Antworten (1)
Bhuvnesh Singh
am 2 Mär. 2018
Hello Morgan,
You have 1X20 matrices. Inorder to see all the values you can do the following:
>> table(n',approx',e',abs_error',rel_error');
Take the transpose of all the variables, so this will convert the variables into 20X1.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Tables finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!