Plotting e^{t + W(t)/2} by calling W(t) function file
Show older comments
I'm trying to plot/figure out why this file isn't working out the way I wanted it to. I have to plot e^{t + W(t)/2} and I'm calling W(t) from a previous file as seen from the brownianPath(T,n). It gives me an exponential curve, which I think isn't what is supposed to happen because when I try to find the mean and plot that, it gives me an error. Thank you.
function [U] = expBrownianPath(T,n)
s = T/n;
t = 0:s:T;
U = zeros(1,n);
W = zeros(1,n);
for j = 2:n
W(j) = brownianPath(T,n);
U(j) = exp(j + (W(j)/2));
end
plot([0:s:T],[0 U], 'g-');
end
Accepted Answer
More Answers (0)
Categories
Find more on Line Plots 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!