how to get scientific notation out of answer
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
function [m,a]= IRA(MS,AI)
%IRA
%MS = Monthly Savings
%AI = Annual Interest
%m = Months until savings is greater than 1,000,000
%a = Actual Dollar Amount of savings for those months
%Brendan Proaps
%Due 9/29/20
%Asumming the Initial Deposit is 0
if nargin == 0
MS = 250;
AI = 6;
end
format shortG
TF = isscalar(MS);
if TF == 0
error('MATLAB:notScalar', 'Inputs must be scalars.')
end
ID = MS;
m = 0;
a = 0;
while a < 1000000
ID = MS + ID.*(1 + (AI./1200));
a = ID-MS;
m = m+1;
end
if m > 600
m = 600;
end
m = m;
a = a;
end
Using this function, I get
>> [m,a]=IRA(200,11)
m =
421
a =
1.004e+06
How do I get the a to not be in scientific notation? None of the format options(ex. shortG) are working.
0 comentarios
Respuestas (1)
Ver también
Categorías
Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!