# I am trying to solve for OS here, but keeping getting pi/2 even when I change L

1 view (last 30 days)
adam puchalski on 11 Jul 2022
Answered: Jeffrey Clark on 11 Jul 2022
%variables
F = .00024; %kg
E = 10^6; %mPa
I = 6.1*10^-9; %kg m^2
L = .01; %m
%solve for Theta sub 0
func = @(initial) L/sqrt((E*I)/(2*F)) - integral(@(theta)1./sqrt(cos(initial)-cos(theta)),initial,pi/2);
OS = fsolve(func,.5);
I am not sure what I am doing wrong here, I hope to find the value of initial, this function is in respect to d theta. Is there anything wrong with this?
I want to then solve for xi which is also funky,
aa = linspace(pi/2*.99, 0, 49);
aa=aa';
%shape of rod given
xi = sqrt((2*E*I)/F)*(sqrt(cos(OS))-sqrt(cos(OS)-cos(aa)));
any help appreciated not sure what is wrong

Jeffrey Clark on 11 Jul 2022
@adam puchalski, you need to limit fsolve such that it doesn't attempt values that cause sqrt(cos(initial)-cos(theta)) to return a complex value, e.g., values >pi/2 and other ranges about the circle:
func(2)
ans =
0.0028 - 1.3565i