Suppressing outputs (ans) in MATLAB
Show older comments
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
hunter hamilton
on 24 Feb 2022
Answers (1)
Jan
on 24 Feb 2022
You need a semicolon after the call of the function:
paths = CEVPaths(S,r,q,vol0,beta,T,N,NPaths);
% ^ here
Categories
Find more on Multicore Processor Targets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!