if逻辑判断。

2 views (last 30 days)
javac
javac on 4 Apr 2023
Answered: mejong hehans on 4 Apr 2023
求解,我先判断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

Accepted Answer

mejong hehans
mejong hehans on 4 Apr 2023
参考代码:
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

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!