필터 지우기
필터 지우기

Help With Nested IF Statements!!!

조회 수: 2 (최근 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 CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by