ALWAYS show what you wrote. Ony you know what you mean by dealing with vectors, etc. In the first case, do you have a vector of values for x, that varies from 0 to L/2?Are L, M, W, E, I all known constants with given values?
First, you need to learn WHEN to use the dotted operators. You only need them when you are multiplying or dividing vectors or arrays of elements, or raising to powers. That tells MATLAB to perform element-wise operations.
However, you can multiply a vector by a scalar or multiply two scalars with no problem.
You can also divide a vector by a scalar using /, but you cannot divide a vector INTO a scalar using the / operator. That is if x is a vector, and a is a scalar, you can do these things using * or / :
because a is a scalar.
However to divide a scalar by a vector, you need to use ./ :
To raise elements to a power, you use .^ , thus you would do:
Raising a scalar to a scalar power is no problem. However
Addition and subtraction are always no problem. There is no .- or .+ operator to worry about.
Given all that, y1 should look like this:
y1 = (-W*x1)/(384*E*I).*(16*x1.^3-24*L*x1.^2+9*L^2)+(M*x1)/(6*E*I*L).*(x1.^2-3*L*x1+2*L^2);