I have the following code:
plot(x,y1,x1,y2,'k') xlabel('Stock Price ($)'); ylabel('Option price ($)'); axis([8 12 -1 2]);
text(10,1.1,'delta-hedge at t=0')
that gives me one straight line and a curve and I would like to plot a third line with the difference (y1-y2) but it's not working, probably due to the fact that there are different elements, is there any way to do this?
No products are associated with this question.
Use interp1() to produce values with a common x base so that you can subtract meaningfully.
thanks! it's working now, but is there really no way to get the exact slope? because I plot the difference (or to be more exact it's the sum because the curve starts negative and the line becomes negative) and the combined position should show a delta hedged position and at the moment it's obvious that this is just an bad proxy