Here are my equations: (only the deflection and M(moment) equations are important)
M=@(x,F) -(w/2)*(x.^2) + F*x + Fb*(x-L/2).*heaviside(x-L/2);
deflection=@(x,c1,c2,F) (1/EI)*(-w*(x.^4)/24 + F*(x.^3)/6 + (1/6)*Fb*((x-L/2).^3).*heaviside(x-L/2) + c1*x + c2);
I wrote an objective function to find the c1 and c2 constants and the F value to optimise my bending moments.
OB1=@(c1,c2,F)(deflection(0,c1,c2,F)).^2 + (deflection(L,c1,c2,F)).^2 + (deflection(L/2,c1,c2,F)).^2;
[c] = fminsearch(@(c,F)OB1(c(1),c(2),c(3)),[-0.5 0 1]);
C1=c(1);
C2=c(2);
f=c(3);
Gives me error message: 'f' undefined. I think the problem is with the OB function and fminsearch.
Could someone help?