How do I make the values appear in the table?

1 view (last 30 days)
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)

Answers (1)

Bhuvnesh Singh
Bhuvnesh Singh on 2 Mar 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.

Categories

Find more on Tables in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!