Introductory course into matlab assignment. Im trying to list the n and A outputs into column list but can get the format right. They mix in between each other.
function [A] = Loanpayment( p,i);n = input('Number of payments: ');%A calcualtes the annual payment to be made
%P= Initial loan amount
%n= Annual payments agreed upon, in this case 5 payments were agreed
%i= Interest rate on P, loan amount
A = (p).* ((i.*(1+i).^n)./((1+i).^n -1));z = linspace(A,0,n);y = [1:n];fprintf('Number of Payments Payment amount\n')%List of Number of...
%payments and amount per payment
fprintf('%g %25.3f \n',z)fprintf('%g %25.3f \n',y)end
Best Answer