Path: news.mathworks.com!not-for-mail
From: "Michael Elite" <elitemichael@yahoo.com>
Newsgroups: comp.soft-sys.matlab
Subject: Matlab programming to find minimum help!?
Date: Sun, 30 Nov 2008 01:49:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 24
Message-ID: <ggsree$3is$1@fred.mathworks.com>
Reply-To: "Michael Elite" <elitemichael@yahoo.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1228009742 3676 172.30.248.38 (30 Nov 2008 01:49:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 30 Nov 2008 01:49:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1622413
Xref: news.mathworks.com comp.soft-sys.matlab:503857


What I need to is to figure out how to find the lowest value for L when Tac and Tab are both <2000.

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 <2000. It simply takes all the values and gives min(L) = 3.


L=3:0.1:6.7;
th = acos((45-L.^2)/36);
ph = asin((6*sin(th))./L);

j=1;

Tab = 2000./(sin(th)+cos(th).*tan(ph));
if Tab<2000 then
Tac = (2000.*cos(th))./(sin(th)+cos(th).*tan(ph));
if Tac<2000 then
ARRAY(j)=(L,Tab,Tac)
j=j+1;
end
end

plot(L,Tab,'m',L,Tac,'b'),xlabel('Length of AC'),ylabel('Tension'),title('Tension Plot');
legend('Tab','Tac');

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!!