MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [求助]高手帮忙我的M-file 請問如何找到 L 的最小值? (https://www.labfans.com/bbs/showthread.php?t=5531)

elitemichael 2008-11-29 01:45

[求助]高手帮忙我的M-file 請問如何找到 L 的最小值?
 
當Tac 和 Tab 都小於2000時,請問如何找到 L 的最小值?
再加一個 While Loop?

[COLOR="Blue"]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(ARRAY(:,1),ARRAY(:,2),'m',ARRAY(:... of AC'),ylabel('Tension'),title('Tension Plot');
legend('Tab','Tac'); [/COLOR]

elitemichael 2008-12-20 16:19

回覆: [求助]高手帮忙我的M-file 請問如何找到 L 的最小值?
 
L由最小的開始,利用while迴圈判斷何時Tab或Tac會大於2000,若同時都小於2000就停下來,併記錄j,也就是L的最小長度L(j)



L=3:0.1:6.7;
th = acos((45-L.^2)/36);
ph = asin((6*sin(th))./L);
Tab = 2000./(sin(th)+cos(th).*tan(ph));
Tac = (2000.*cos(th))./((sin(th)+cos(th).*tan(ph)));



j=1;
while Tab(j)>=2000 | Tac(j)>=2000
j=j+1;
end
L(j)






執行結果



L =



3.4000


所有时间均为北京时间。现在的时间是 05:44

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.