undefined function variable 'x'

1 view (last 30 days)
JENNY CHENG
JENNY CHENG on 19 Apr 2015
Commented: Geoff Hayes on 19 Apr 2015
Hi all,
My code doesn't work, I'm pretty sure the logic is correct. it always gives me ' undefined function variable x'. I don't know how to make it work. Seems like the handling function @x....
I show the code below. Thanks all!
syms x
for i = 2 : 1
b = 0;
a = i + 1;
for j = 1 : i
b = SP(j,i) * p * PR(j,i) * ((exp(-(R(j,i) + x * dt + d) * dt) + exp(-(R(j,i) + x * dt - d) * dt))) + b;
end
H(i) = fsolve(@(x)P(a) - FV * b, 0.1);
for m = 1 : i
R(m,a) = R(m,i) + H(i) * dt + d;
PR(m,a) = exp(-R(m,a) * dt);
end
for aa = 2 : 10
a = aa + 1;
SP(1,a) = p * SP(1,aa) * PR(1,aa);
L = SP(1,a);
for bb = 2 : aa
SP(bb,a) =p * SP(bb,bb) * PR(bb,bb) + L;
L = SP(bb,a) + L;
end
SP(aa+1,a) = p * PR(aa,aa) * SP(aa,aa);
end
end

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!