2013-04-11 2 views
0

Я пытаюсь выполнить это уравнение в scilab; однако, я получаю ошибку: 59 функции% s_pow называется ... хотя я определяю x.scilab построение факториала; сначала попытаться исправить уравнение?

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) 

(в этот момент я не добавил в команде сюжета, хотя я бы предположить, что это участок (т)?)

Спасибо за любой вклад.

ответ

1

Сила x^n и (1-x)^(3-n) на последней строке и вызвать проблемы, так как x и n матрицы, и они не имеют одинаковый размер.

Как уже упоминалось в documentation операция мощности может быть выполнено только между:

  • (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).

Смежные вопросы