<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240134</link>
    <title>MATLAB Central Newsreader - Matlab programming to find minimum help!?</title>
    <description>Feed for thread: Matlab programming to find minimum help!?</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Sun, 30 Nov 2008 01:49:02 -0500</pubDate>
      <title>Matlab programming to find minimum help!?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240134#613927</link>
      <author>Michael Elite</author>
      <description>What I need to is to figure out how to find the lowest value for L when Tac and Tab are both &amp;lt;2000.&lt;br&gt;
&lt;br&gt;
I've tried directing them into an array, and trying to find the minimum of the array, but I can't seem to get the array to only take values where tac and tab are both &amp;lt;2000. It simply takes all the values and gives min(L) = 3.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
L=3:0.1:6.7;&lt;br&gt;
th = acos((45-L.^2)/36);&lt;br&gt;
ph = asin((6*sin(th))./L);&lt;br&gt;
&lt;br&gt;
j=1;&lt;br&gt;
&lt;br&gt;
Tab = 2000./(sin(th)+cos(th).*tan(ph));&lt;br&gt;
if Tab&amp;lt;2000 then&lt;br&gt;
Tac = (2000.*cos(th))./(sin(th)+cos(th).*tan(ph));&lt;br&gt;
if Tac&amp;lt;2000 then&lt;br&gt;
ARRAY(j)=(L,Tab,Tac)&lt;br&gt;
j=j+1;&lt;br&gt;
end&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
plot(L,Tab,'m',L,Tac,'b'),xlabel('Length of AC'),ylabel('Tension'),title('Tension Plot');&lt;br&gt;
legend('Tab','Tac');&lt;br&gt;
&lt;br&gt;
How do I put everything in a while loop where L starts as 3 and then increases by 0.1 until it get 6.7 ...  HELP!!</description>
    </item>
    <item>
      <pubDate>Sun, 30 Nov 2008 02:25:03 -0500</pubDate>
      <title>Re: Matlab programming to find minimum help!?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240134#613932</link>
      <author>Ryan Ollos</author>
      <description>&quot;Michael Elite&quot; &amp;lt;elitemichael@yahoo.com&amp;gt; wrote in message &amp;lt;ggsree$3is$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; What I need to is to figure out how to find the lowest value for L when Tac and Tab are both &amp;lt;2000.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I've tried directing them into an array, and trying to find the minimum of the array, but I can't seem to get the array to only take values where tac and tab are both &amp;lt;2000. It simply takes all the values and gives min(L) = 3.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; L=3:0.1:6.7;&lt;br&gt;
&amp;gt; th = acos((45-L.^2)/36);&lt;br&gt;
&amp;gt; ph = asin((6*sin(th))./L);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; j=1;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Tab = 2000./(sin(th)+cos(th).*tan(ph));&lt;br&gt;
&amp;gt; if Tab&amp;lt;2000 then&lt;br&gt;
&amp;gt; Tac = (2000.*cos(th))./(sin(th)+cos(th).*tan(ph));&lt;br&gt;
&amp;gt; if Tac&amp;lt;2000 then&lt;br&gt;
&amp;gt; ARRAY(j)=(L,Tab,Tac)&lt;br&gt;
&amp;gt; j=j+1;&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; plot(L,Tab,'m',L,Tac,'b'),xlabel('Length of AC'),ylabel('Tension'),title('Tension Plot');&lt;br&gt;
&amp;gt; legend('Tab','Tac');&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; How do I put everything in a while loop where L starts as 3 and then increases by 0.1 until it get 6.7 ...  HELP!!&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
It seems like you don't necessarily need to use a WHILE or FOR loop.  With a conditional like this, I think it is easier to understand using conditionals.&lt;br&gt;
&lt;br&gt;
L=3:0.1:6.7;&lt;br&gt;
th = acos((45-L.^2)/36);&lt;br&gt;
ph = asin((6*sin(th))./L);&lt;br&gt;
&lt;br&gt;
Tab = 2000./(sin(th)+cos(th).*tan(ph));&lt;br&gt;
Tac = (2000.*cos(th))./(sin(th)+cos(th).*tan(ph));&lt;br&gt;
&lt;br&gt;
isTabConditional = ( Tab &amp;lt; 2000 );&lt;br&gt;
isTacConditional = ( Tac &amp;lt; 2000 );&lt;br&gt;
&lt;br&gt;
Array = L( isTabConditional &amp; isTacConditional );&lt;br&gt;
&lt;br&gt;
plot(L,Tab,'m',L,Tac,'b'),xlabel('Length of AC'),ylabel('Tension'),title('Tension Plot');&lt;br&gt;
legend('Tab','Tac');&lt;br&gt;
&lt;br&gt;
[mOfArray, mIdxOfArray] = min(Array);&lt;br&gt;
&lt;br&gt;
fprintf(1, 'Min of Array is %d, Min index of Array is %d\n', ...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;mOfArray, mIdxOfArray);</description>
    </item>
    <item>
      <pubDate>Tue, 02 Dec 2008 06:56:01 -0500</pubDate>
      <title>Re: Matlab programming to find minimum help!?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240134#614373</link>
      <author>Michael Elite</author>
      <description>L=3:0.1:6.7;&lt;br&gt;
th = acos((45-L.^2)/36);&lt;br&gt;
ph = asin((6*sin(th))./L);&lt;br&gt;
Tab = 2000./(sin(th)+cos(th).*tan(ph));&lt;br&gt;
Tac = (2000.*cos(th))./((sin(th)+cos(th).*tan(ph)));&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
j=1;&lt;br&gt;
while Tab(j)&amp;gt;=2000 | Tac(j)&amp;gt;=2000&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;j=j+1;&lt;br&gt;
end&lt;br&gt;
L(j)&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;#22519;&amp;#34892;&amp;#32080;&amp;#26524;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
L =&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;3.4000&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; j&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
j =&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;5</description>
    </item>
  </channel>
</rss>

