"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
> 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