Got Questions? Get Answers.
Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Options - Derivatives

Subject: Options - Derivatives

From: Pallav Mishra

Date: 19 Jan, 2013 03:51:08

Message: 1 of 3

I am trying to plot an intrinsic value of a call option, which is max(S-K,0), with
strike $50, and stock price changes from $0.01 to 100..wanted to know how to do this right, because its throwing an error. Its obvious that plot (x,y) should have x and y of the same length:

>> plot( 0.01:0.01:100, max(0.01:0.01:(100-50),0),'b')


Error using plot
Vectors must be the same lengths.

Subject: Options - Derivatives

From: Roger Stafford

Date: 19 Jan, 2013 04:15:09

Message: 2 of 3

"Pallav Mishra" wrote in message <kdd57c$d79$1@newscl01ah.mathworks.com>...
> I am trying to plot an intrinsic value of a call option, which is max(S-K,0), with
> strike $50, and stock price changes from $0.01 to 100..wanted to know how to do this right, because its throwing an error. Its obvious that plot (x,y) should have x and y of the same length:
>
> >> plot( 0.01:0.01:100, max(0.01:0.01:(100-50),0),'b')
>
>
> Error using plot
> Vectors must be the same lengths.
- - - - - - - - - -
  I am guessing you want this:

 x = 0.01:0.01:100;
 y = max(50-x,0);
 plot(x,y)

Roger Stafford

Subject: Options - Derivatives

From: Pallav Mishra

Date: 19 Jan, 2013 04:55:08

Message: 3 of 3

"Roger Stafford" wrote in message <kdd6kc$hcr$1@newscl01ah.mathworks.com>...
> "Pallav Mishra" wrote in message <kdd57c$d79$1@newscl01ah.mathworks.com>...
> > I am trying to plot an intrinsic value of a call option, which is max(S-K,0), with
> > strike $50, and stock price changes from $0.01 to 100..wanted to know how to do this right, because its throwing an error. Its obvious that plot (x,y) should have x and y of the same length:
> >
> > >> plot( 0.01:0.01:100, max(0.01:0.01:(100-50),0),'b')
> >
> >
> > Error using plot
> > Vectors must be the same lengths.
> - - - - - - - - - -
> I am guessing you want this:
>
> x = 0.01:0.01:100;
> y = max(50-x,0);
> plot(x,y)
>
> Roger Stafford

-------------

Thanks, Roger!..it would be y = max(x-50,0) but you nailed it..really appreciate your help! - P

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us