Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Matrix multiplication woes
Date: Fri, 5 Nov 2010 16:54:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 36
Message-ID: <ib1crc$6ep$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1288976044 6617 172.30.248.35 (5 Nov 2010 16:54:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 5 Nov 2010 16:54:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1608486
Xref: news.mathworks.com comp.soft-sys.matlab:684209

[code]

function U= sabrCall(S,K,sig,r,T,nu,beta,rho,Smax,dS,Numax,dnu,dt,greek)

if nargin < 14, greek =1;end

NS=round(1/dS);
dS=1/NS;
Nnu=round(1/dnu);
dnu=1/Nnu;
Nt=round(T/dt);
dt=T/Nt;

Layers=zeros(2,NS+1,Nnu+1);

tpast=1;
tnow=2;

Svalue=0:dS:Smax;
Vvalue=0:dnu:Numax;

payoff=max(Svalue-K,0);
Layers(tpast,:,:)=payoff'*ones(1,Nnu+1);

[S,VOL]= meshgrid(0:dS:Smax,0:dnu:Numax);

Layers(tpast,1:NS,1:Nnu)=max(vetS-K,0);

U =1;
end

[/code]

The line Layers(tpast,:,:)=payoff'*ones(1,Nnu+1);

is coming back as a dimensions mismatch but I don't see why? Moreover when I try to run the program with stops nothing shows in the workspace? Why is this?? It makes it alot harder to debug.