# what is wrong with this code?

##### 0 Comments

### Answers (2)

Your y2 is numeric, so diff(y2, 2) is requesting the second numeric differences of the numeric array. The resulting numeric array is taken to the power of the numeric variable pr (value 1) and the result is stored in a. Then b is calculated exactly the same way, giving exactly the same result.

So now a is a pure numeric array. And you seem to intend to integrate it with respect to the symbolic variable eta. But there is no routine named int() that accepts numeric first argument.

What you could do is to

int(sym(a), 'eta', 0, 10)

There would be little point in doing that, but it could be done. The integral of a numeric constant with respect to definite bounds is just the constant times the difference between the bounds, so just multiplying a by 10 would achieve the same effect.

##### 8 Comments

### See Also

### Categories

### Community Treasure Hunt

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

Start Hunting!