if逻辑判断。

1 vue (au cours des 30 derniers jours)
javac
javac le 4 Avr 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

Réponse acceptée

mejong hehans
mejong hehans le 4 Avr 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

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by