Suppressing outputs (ans) in MATLAB

I am getting an output although I have suppressed every line can anyone tell me why?
function paths = CEVPaths (S,r,q,vol0,beta,T,N,NPaths)
paths = zeros(NPaths,N+1);
paths(:,1) = S;
dT = T/N;
% Calibrate CEV sigma to match intial vol input
sigma = vol0 * S^((2-beta)/2);
for i = 1:NPaths
for j = 1:N
drift = (r - q - 0.5 * sigma^2 * (paths(i,j)^(beta-2))) * dT;
risk = sigma * paths(i,j)^((beta-2)/2)* sqrt(dT);
paths(i,j+1) = paths(i,j)*exp(drift + risk*randn);
end
end
for i = 1:NPaths
plot(0:dT:T,paths(i,:)) ;
hold on ;
end
hold off ;
end

1 Comment

I am getting ans = and then all the values printed in the command window but from what i can tell i have a semicolon after every line?

Sign in to comment.

Answers (1)

You need a semicolon after the call of the function:
paths = CEVPaths(S,r,q,vol0,beta,T,N,NPaths);
% ^ here

Categories

Asked:

on 24 Feb 2022

Answered:

Jan
on 24 Feb 2022

Community Treasure Hunt

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

Start Hunting!