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)
0 件のコメント
回答 (1 件)
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.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Tables についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!