Azzera filtri
Azzera filtri

if loop not working..please help.

1 visualizzazione (ultimi 30 giorni)
an
an il 28 Mar 2014
Commentato: Azzi Abdelmalek il 28 Mar 2014
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 Commento
Azzi Abdelmalek
Azzi Abdelmalek il 28 Mar 2014
How it's not working? any error message? are you expecting another result?

Accedi per commentare.

Risposta accettata

Azzi Abdelmalek
Azzi Abdelmalek il 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 Commenti
an
an il 28 Mar 2014
Thank You..this works,but i dint understood what this represents. can you please explain what for this ones(size(s)) and idx1 represens

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by