if loop not working..please help.
1 view (last 30 days)
Show older comments
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 Comment
Azzi Abdelmalek
on 28 Mar 2014
How it's not working? any error message? are you expecting another result?
Accepted Answer
Azzi Abdelmalek
on 28 Mar 2014
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 Comments
More Answers (0)
See Also
Categories
Find more on Entering Commands in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!