How do I make the values appear in the table?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Bhuvnesh Singh
il 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.
0 Commenti
Vedere anche
Categorie
Scopri di più su Tables in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!