Help With Nested IF Statements!!!

1 回表示 (過去 30 日間)
Omar
Omar 2020 年 3 月 23 日
コメント済み: Omar 2020 年 3 月 24 日
I would really appreciate if someone can help me why I am not getting the graph in the picture using the following code:
clear all;
clc;
close all;
Ss = 0.263;
S1 = 0.103;
Fa = 0.8;
Fv = 0.8;
TL = 10;
Sms = Fa*Ss;
Sm1 = Fv*S1;
Sds = (2/3)*Sms;
Sd1 = (2/3)*Sm1;
To = 0.2*(Sd1/Sds);
Ts = (Sd1/Sds);
T11 = [0:0.01:To]; T12 = T11(end)+0.0083; T1 = [T11,T12];
T21 = T1(end)+0.01:0.01:Ts; T22 = [T21(end)+0.0033]; T2 = [T21,T22];
T31 = T2(end)+0.01:0.01:TL; T32 = [T31(end)+0.0084]; T3 = [T31,T32];
T4 = T3(end)+0.01:0.01:12;
T = [T1,T2,T3,T4];
for j = 1:1:length(T)
Sa(1) = Sd1;
if T > 0 & T <= To
Sa(j) = Sds*(0.4+0.6*(T(j)/To));
elseif T > To & T <= Ts
Sa(j) = Sds;
elseif T > Ts & T <= TL
Sa(j) = Sd1/T(j);
else
Sa(j) = Sd1*TL/T(j)^2;
end
end

採用された回答

Fangjun Jiang
Fangjun Jiang 2020 年 3 月 23 日
if T > 0 & T <= To
needs to be
if T(j) > 0 & T(j) <= To
  1 件のコメント
Omar
Omar 2020 年 3 月 24 日
Thank you Jiang so much.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by