Help with heat equation
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello I have the following question
I am trying to understand how to do from the heat equation part Can anyone help?
0 comentarios
Respuestas (1)
Image Analyst
el 15 de Jun. de 2018
Try
sigma = 0.2;
r = 0.05;
S0 = 10 : 10 : 100;
K = 50
T = 2
xmax = 10
xmin = -10
N = [10, 100, 200, 400, 800];
M = N
for k = 1 : length(N)
thisM = M(k);
thisN = N(k);
blsprice(................
absoluteError = .........
plot(S0, absoluteError, 'b*-');
hold on;
grid on;
end
I don't know what "the Call Option" or the heat equation or blsprice() is so I can't help with that, but at least this is a start. Presumably blsprice() uses those parameters as inputs. I'm also not sure how to calculate the absolute error.
3 comentarios
Image Analyst
el 15 de Jun. de 2018
You can't do
for n = 2:N
because N is an array. You have to think what you really want. You need to extract the values of M and N from the array and use them somehow.
Even if you did
for n = N
which is allowed, n would take on the value of N(1) first, which is 10. So then you say
v(1, 10) = v(1,1);
well, what about the rest of the array? What about columns 2 through 9?
You also shouldn't do
v = zeros(M,N);
because they're arrays. You can if you use thisM and thisN and put that inside the loop as I showed you. Take another crack at it.
Ver también
Categorías
Más información sobre General Physics 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!