Hi all, I have the following equation, in which theta varies from 0 degree to 90 degree with an interval of 5 degree. I need to find "r" value corresponding to each " theta " value. 25*r*sin(theta)-1.5915*atan(2*r*sin(theta)/(r*r-1))=0 What is the procedure I have to do to find the " r " values to the corresponding " theta " values? Kindly give help me in this regard. Thanks

0 |

12/23/2016 6:32:03 PM

"Teja Reddy" wrote in message <o3jqj3$m00$1@newscl01ah.mathworks.com>... > Hi all, > I have the following equation, in which theta varies from 0 degree to 90 degree with an interval of 5 degree. I need to find "r" value corresponding to each " theta " value. > > 25*r*sin(theta)-1.5915*atan(2*r*sin(theta)/(r*r-1))=0 > > What is the procedure I have to do to find the " r " values to the corresponding " theta " values? > Kindly give help me in this regard. > Thanks See help file for fzero command. If you have the optimization toolbox, see help file for fsolve command. If you have the symbolic toolbox, see help file for solve command. Using fzero, try setting theta, and then solve for r, individually. Then you can automate it as below. The answers are all zero, for every value of theta, since that is an acceptable solution for your equation for each value of theta, from 0 to 90 degrees. clear clc myFun = @(r, theta) 25*r*sin(theta)-1.5915*atan(2*r*sin(theta)/(r*r-1)); x0=0.1; theta=[0:5:90]* pi/180; %Convert theta to radians - no effect on answer for ti = 1:size(theta,2) tvar = theta(ti); % current value for theta solution(ti) = fzero( @(r) myFun( r, tvar ), x0); end solution Regards, Georgios

0 |

12/23/2016 10:49:03 PM

"Teja Reddy" wrote in message <o3jqj3$m00$1@newscl01ah.mathworks.com>... > Hi all, > I have the following equation, in which theta varies from 0 degree to 90 degree with an interval of 5 degree. I need to find "r" value corresponding to each " theta " value. > > 25*r*sin(theta)-1.5915*atan(2*r*sin(theta)/(r*r-1))=0 > > What is the procedure I have to do to find the " r " values to the corresponding " theta " values? > Kindly give help me in this regard. > Thanks Dear Georgios, Thank you so much for your reply. But, when I calculate " r " value physically for "theta=90 deg", the r value is not zero. The value of " r=2.84 ". I wonder, where the mistake is..... If you clear me, I will be grateful to you Georgios.... Thank you so much in advance.

0 |

12/24/2016 1:39:04 AM

"Georgios" wrote in message <o3k9kv$nv2$1@newscl01ah.mathworks.com>... > "Teja Reddy" wrote in message <o3jqj3$m00$1@newscl01ah.mathworks.com>... > > Hi all, > > I have the following equation, in which theta varies from 0 degree to 90 degree with an interval of 5 degree. I need to find "r" value corresponding to each " theta " value. > > > > 25*r*sin(theta)-1.5915*atan(2*r*sin(theta)/(r*r-1))=0 > > > > What is the procedure I have to do to find the " r " values to the corresponding " theta " values? > > Kindly give help me in this regard. > > Thanks > > See help file for fzero command. > If you have the optimization toolbox, see help file for fsolve command. > If you have the symbolic toolbox, see help file for solve command. > > Using fzero, try setting theta, and then solve for r, individually. Then you can automate it as below. The answers are all zero, for every value of theta, since that is an acceptable solution for your equation for each value of theta, from 0 to 90 degrees. > > > clear > clc > myFun = @(r, theta) 25*r*sin(theta)-1.5915*atan(2*r*sin(theta)/(r*r-1)); > x0=0.1; > theta=[0:5:90]* pi/180; %Convert theta to radians - no effect on answer > > for ti = 1:size(theta,2) > tvar = theta(ti); % current value for theta > solution(ti) = fzero( @(r) myFun( r, tvar ), x0); > end > solution > > Regards, > Georgios Dear Georgios, Thank you very much for your reply. But, when I physically calculate "r" value for " theta=90 deg", the "r =2.84"., can you clear me where I am doing mistake. I am grateful to you Georgios for your help. Teja

0 |

12/24/2016 1:44:03 AM

On 12/23/2016 7:44 PM, Teja Reddy wrote: > Dear Georgios, > Thank you very much for your reply. > But, when I physically calculate "r" value for " theta=90 deg", the "r =2.84"., >can you clear me where I am doing mistake. > I am grateful to you Georgios for your help. > Teja > You can plot the function for different theta, and see where the "zero" is, this use fzero to look starting near there. I do not know how you got 2.84. If you show what you did, may be it will help. theta=pi/2; f=@(r) 25*r*sin(theta)-1.5915*atan(2*r*sin(theta)./(r.*r-1)) r=0:.1:3; plot(r,f(r)) You see that f=0 at r=0 there? Actually, f at the r you show is >> f(2.84) 69.9224 Not zero? Try for different angles, and you'll get r=zero also as root. --Nasser

0 |

12/24/2016 2:35:16 AM

"Teja Reddy" wrote in message <o3kjt3$g3l$1@newscl01ah.mathworks.com>... > "Georgios" wrote in message <o3k9kv$nv2$1@newscl01ah.mathworks.com>... > > "Teja Reddy" wrote in message <o3jqj3$m00$1@newscl01ah.mathworks.com>... > > > Hi all, > > > I have the following equation, in which theta varies from 0 degree to 90 degree with an interval of 5 degree. I need to find "r" value corresponding to each " theta " value. > > > > > > 25*r*sin(theta)-1.5915*atan(2*r*sin(theta)/(r*r-1))=0 > > > > > > What is the procedure I have to do to find the " r " values to the corresponding " theta " values? > > > Kindly give help me in this regard. > > > Thanks > > > > See help file for fzero command. > > If you have the optimization toolbox, see help file for fsolve command. > > If you have the symbolic toolbox, see help file for solve command. > > > > Using fzero, try setting theta, and then solve for r, individually. Then you can automate it as below. The answers are all zero, for every value of theta, since that is an acceptable solution for your equation for each value of theta, from 0 to 90 degrees. > > > > > > clear > > clc > > myFun = @(r, theta) 25*r*sin(theta)-1.5915*atan(2*r*sin(theta)/(r*r-1)); > > x0=0.1; > > theta=[0:5:90]* pi/180; %Convert theta to radians - no effect on answer > > > > for ti = 1:size(theta,2) > > tvar = theta(ti); % current value for theta > > solution(ti) = fzero( @(r) myFun( r, tvar ), x0); > > end > > solution > > > > Regards, > > Georgios > > > > Dear Georgios, > Thank you very much for your reply. > But, when I physically calculate "r" value for " theta=90 deg", the "r =2.84"., can you clear me where I am doing mistake. > I am grateful to you Georgios for your help. > Teja Hello Teja. How did you solve for r value. I did it in Matlab, as outlined above, and in Maple, and I got 0 for all values of theta. For your solution, of r=2.84, what happens when you substitute this back into your original equation? Do you get 0? Try the code below for different values of theta, and see what happens. In all cases, the plot is a straight line going through the origin. Maybe I am missing something. >> clear >> r=-2:.00001:2; >> theta=90; >> eq=25*r.*sin(theta)-1.5915*atan(2*r.*sin(theta)./(r.*r-1)); >> plot(r,eq); >> grid Regards, Georgios

0 |

12/24/2016 2:57:07 AM