Here's my function:
---
function F = SPI(x,b)
F = [gamcdf(b(1),x(1),x(2))-0.4;
gamcdf(b(2),x(1),x(2))-0.6];
---
and my command is:
---
b(1)=4;
b(2)=6;
F = SPI(x,b);
x0 = [2; 0.8];
options=optimset('Display','iter');
[x,fval] = fsolve(@SPI,x0,options)
---
I get this error:
??? Error using ==> mupadmex
Error in MuPAD command: Index exceeds matrix dimensions.
Error in ==> sym.sym>sym.subsref at 1366
B = mupadmex('mllib::subsref',A.s,inds{:});
Error in ==> SPI at 3
F = [gamcdf(b(1),x(1),x(2))-0.4;
Please help ! -- it works if I replace numbers instead of b

 採用された回答

Andrei Bobrov
Andrei Bobrov 2011 年 12 月 27 日

0 投票

try this cod:
b = [4;6];
F = @(x,b)[gamcdf(b(1),x(1),x(2))-0.4;gamcdf(b(2),x(1),x(2))-0.6];
[x,fval] = fsolve(@(x)F(x,b),[2;.8])

1 件のコメント

Amin Zargar
Amin Zargar 2011 年 12 月 27 日
thanks a lot again !

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by