Answered How to remove numbers from a vector?
You could use something like:
while z_force(1)==0
z_force(1) = [];
end
while z_force(end)==0
z_force(end) = [];
en...
Answered what is the wrong here
David is probably right, but I made a different assumption about what equation you were trying to solve:
h = 0.25;
x = 0:h:1;
...