How do I make the values appear in the table?

1 次查看(过去 30 天)
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)

回答(1 个)

Bhuvnesh Singh
Bhuvnesh Singh 2018-3-2
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.

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by