- Don't need syms unless you were to try to solve for a symbolic solution; to find a numeric solution it isn't of any use
- The loop construct in Matlab would be for l=0:deltaL:L
where deltaL is the increment and L the upper limit. Note, however, that there's no guarantee that at the resolution there would be an exact solution, you would want to write the if as
where e is an error of convergence. Even here, you really don't know that you're going to be close enough to any arbitrary solution so robustness would be to test for a change in sign of the difference which then gives you a bounding location.
But, in Matlab, the way to do things like this is to use fzero
Write
>> e=1800; t=120;
>> p=1000; w=0;
>> f= @(l) ((3*(p*l+0.5*w*l*l))/(32*e))^(1/3)-((3*(p+w*l))/(16*t))^(1/2);
>> L1=fzero(f,50)
L1 =
37.5000
>>
In general, write the routine to
- read the input values that aren't constants
- set the anonymous function for those values
- call fzero() with that definition of the function
- repeat for cases as desired.