if loop not working..please help.
1 回表示 (過去 30 日間)
古いコメントを表示
clc
clear all
Pc=620*10^6
Pa=62*10^9
Ps=1*10^9
r=10
d0=0.4
d=1:5:100
s=(d./r)
s1=s
w1=4.3
w2=4.66
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)
i=2
e1=1
if s<i;
e1=1;
elseif (s>i)
e1=s./4
else
e1=(s+2)./4
end
x1=e1
1 件のコメント
Azzi Abdelmalek
2014 年 3 月 28 日
How it's not working? any error message? are you expecting another result?
採用された回答
Azzi Abdelmalek
2014 年 3 月 28 日
Replace the If/else by
e1=ones(size(s))
idx1=s>i;
e1(idx1)=s(idx1)/4
idx2=s==i;
e1(idx2)=(s(idx2)+2)/4
x1=e1
2 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Entering Commands についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!