if逻辑判断。

2 ビュー (過去 30 日間)
javac
javac 2023 年 4 月 4 日
回答済み: mejong hehans 2023 年 4 月 4 日
求解,我先判断Z1和as1大小关系,然后在里面如何嵌套另一个逻辑判断;标红的地方
function Fy = fcn(N1,alpha1)
cf=1000;
Z1=tan(alpha1);
as1=atan(3*N1/cf);
for i=0:0.02:15
if abs(Z1)>=tan(as1)
Fy=-cf*Z1+cf^2*abs(Z1)*Z1/3*N1-cf^3*Z1^3/27*N1^2;
elseif as1>0
Fy=-N1*(-1);
elseif as1==0
Fy=0;
elseif as1<0
Fy=-N1;
end
end
end

採用された回答

mejong hehans
mejong hehans 2023 年 4 月 4 日
参考代码:
clear;clc
a = 6;
c = 11;
d = 10;
if a>3 & a<=5
    b=1;
elseif a>5 & a<=9
    if c == 10 & d == 10
        b = 2;
    else
        b = 1000;
    end
elseif a>9
    b = 3;
end
b

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by