Path: news.mathworks.com!not-for-mail
From: "Dimitrios Zlitidis" <dimitriszli@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: ??? Error using ==> times Matrix dimensions must agree.
Date: Sun, 14 Dec 2008 20:02:01 +0000 (UTC)
Organization: Auth
Lines: 50
Message-ID: <gi3onp$8g9$1@fred.mathworks.com>
Reply-To: "Dimitrios Zlitidis" <dimitriszli@gmail.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1229284921 8713 172.30.248.35 (14 Dec 2008 20:02:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 14 Dec 2008 20:02:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1574742
Xref: news.mathworks.com comp.soft-sys.matlab:506940


I've made this function: 

"function y = myfun3(I)

 global R;
 global Imed;
 global si;
 global hm;
 global hp;
 
 
 a = atan(R/(hm-hp));
 rc = (0.67).*(I.^0.74).*(hp.^0.6);
 rs = (0.67).*(I.^0.74).*(hm.^0.6);
 c = sqrt( (hm - hp).^2 + R.^2);
 d = (rc.^2 - rs.^2 + c.^2)./(2.*c);
 b1 = acos(d./rc);
 
 W = (a-b1+pi./2).*rc;
 f= (1./(sqrt(2*pi)*si*I)).*exp(-(log(I)-log(Imed)).^2/(2*si^2));
 
 y = W.*f;"

In my main function I use it like this:
"J = quad(@myfun3, Ic, Im)
        SFFR = 0.2*Ng*J"

The message I take is:
"??? Error using ==> times
Matrix dimensions must agree.

Error in ==> myfun3 at 11
 rc = (0.67).*(I.^0.74).*(hp.^0.6);

Error in ==> quad at 77
y = f(x, varargin{:});

Error in ==> Eriksson_gui>pushbutton2_Callback at 411
        J = quad(@myfun3, Ic, Im)

Error in ==> gui_mainfcn at 96
        feval(varargin{:});

Error in ==> Eriksson_gui at 42
    gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback"

What do I do wrong?!?!?!