0
votes

I'm trying to execute this equation in scilab; however, I'm getting error: 59 of function %s_pow called ... even though I define x.

n=0:1:3;
x=[0:0.1:2];
z = factorial(3); w = factorial(n);u = factorial(3-n);
y = z /(w.*u);
t = y.*x^n*(1-x)^(3-n)

(at this point I haven't added in the plot command, although I would assume it's plot(t)?)

Thanks for any input.

1

1 Answers

1
votes

The power x^n and (1-x)^(3-n) on the last line both cause the problem, because x and n are matrices and they are not the same size.

As mentioned in the documentation the power operation can only be performed between:

  • (A:square)^(b:scalar) If A is a square matrix and b is a scalar then A^b is the matrix A to the power b.

  • (A:matrix).^(b:scalar) If b is a scalar and A a matrix then A.^b is the matrix formed by the element of A to the power b (elementwise power). If A is a vector and b is a scalar then A^b and A.^b performs the same operation (i.e elementwise power).

  • (A:scalar).^(b:matrix) If A is a scalar and b is a matrix (or vector) A^b and A.^b are the matrices (or vectors) formed by a^(b(i,j)).

  • (A:matrix).^(b:matrix) If A and b are vectors (matrices) of the same size A.^b is the A(i)^b(i) vector (A(i,j)^b(i,j) matrix).