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 CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by