How to calculate bending moments and shear forces on a wing?
I would highly recommend to discretize your problem, for two reasons:

You are using Matlab which is most suitable for a discrete approach anyways
More complex load cases will make analytical continuous modelling difficult. This is why these kind of problems are typically solved numerically

So now the question how can we discretly regard this problem? For the wing bending moment, this is pretty straightforward. First of all, lets make a small sketch.

The process of discretization is now to look at equally spaced points of the wing seperated by the distance Δd. I call them discretization points. I have labeled them in the following sketch as a vertical line numbered as 1, 2, 3 ... until point i.

What you need to do now, is to calculate the force acting on each discrete point. This part in turn is divided into two parts:

Calculating the exact shape of the different forces: Therefore force of motor weight, force of the wing structure and as a function of these two, the bell function of the lift
Integrate the wing lift force and structural weight force from discretization point k-1 to point k.

Now you have the exact weight acting on each point k (simply the integration of the wing lift force and the structural weight force from point k-1 to point k). Calculating the bending moment is now straightforward. For example, the bending moment at point i-1 is just the force acting on point i times the distance from point i-1 to i:
$$ M_{i-1} = i \cdot \Delta d \cdot F_i $$
the bending moment at point i-2 is now therefore:
$$M_{i-2} = 2*\Delta d \cdot F_i + \Delta d \cdot F_{i-1}$$
and so forth and so on.
The shear force at these points is even simpler. It is just the sum of all forces at the different outboard. So for example at point i-2:
$$ F_{i-2} = F_i + F_{i-1} $$
You can see that this type of equations can be easily programmed in Matlab. If you program this a bit cleverly, you can even play around with different values of Δd, which enables you to see the effects of discretization.
Hope this helps. If you need more help with the code, feel free to ask.