MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today
Asked by Locks on 24 Mar 2013

x=[0:0.01:20] y=max(x-10,0)-blsprice(10,10,0.02,0.2,0.2)

plot(x,y)

xlabel('Stock Price at Maturity ($)'); ylabel('Gain ($)'); axis([0 20 -2 10]);

set(gca,'Box','off')

The command above gives me the payoff of an call option, unfortunately the x-axis goes from -2 to 20, but I would like to see the x-axis from 0 to 20, so the starting point should be y=0 and not y=-2. However the plot should still show the y-axis from -2 to 10 and the negative values for y

*No products are associated with this question.*

Answer by Azzi Abdelmalek on 24 Mar 2013

xlim([0 20]) ylim([0 10])

Show 2 older comments

Locks on 24 Mar 2013

like this, the x-axis starts at y=-2, but I would like to have the x-axis starting at y=0

similar to this payoff diagram here:

## 0 Comments