why "if loop" contents not getting computed?
1 回表示 (過去 30 日間)
古いコメントを表示
clc
clear all
Pc=620*10^6
Pa=62*10^9
Ps=1*10^9
r=10
d0=0.4
d=[10 20 30 40 50 60 70 80 90 100]
s=(d./r)
k1=1
k2=(s+2)./4
k3=s./4
s1=s
w1=4.3
E0=8.85*10^-12
Eb=6.830890.*(w1.^(3/2))
B1=(d./d0).^(1/3)
l=(Eb./B1)
m= (2.*Pc./E0).^(1/2)
n=(8.*Pa./(E0.*(1+s).^4)).^(1/2)
x1=min(m,n)
Es=min(x1,l)
l1= 0.5.*E0.*l.^2.*10^18
n1=(4.*Pa)./((1+(s)).^4)
y1=min(l1,Pa)
y2=min(y1,n1)
if s1<2
e1=k1
elseif s1>=2
e1=k2
else s1>2
e1=k3
end
0 件のコメント
採用された回答
Joseph Cheng
2014 年 3 月 27 日
if statements do not work this way. how it is written is if all of s1 is <2. I would suggest read the document on if statements and write a for loop or something like this.
e1(s1<2) = k1; %which says for the index positions where s1 < 2 substitute k1 into e1.
i do not understand what you are doing with s1>2. or should the second nested if statement be s1==2?
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!