I am trying to solve for OS here, but keeping getting pi/2 even when I change L
Show older comments
%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
Answers (1)
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
Categories
Find more on Mathematics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!