- #1
Hikarikaze
- 4
- 0
Hi, I have a question about comparing each and every element in a matrix..
Heres what i have,
S1 = 90
S2 = 1
delta = 0.75
SM = 80
m = 0.1:0.01:100;
if (S1-S2*m.^(delta))>=SM
S_avg = SM
elseif (S1-S2*m.^(delta))<SM & (S1-S2*m.^(delta))>0
S_avg = (S1-S2*m.^(delta))
else S_avg = 0
end
I want all the values that exceed SM to be equal to SM (as it is the limit) or let the iteration just stop there and keep the number as it is if the value is below SM (below the limit).
for whatever input S1, S2, delta, and SM is..
for a different equation will be used for each case..
Is that possible?
Heres what i have,
S1 = 90
S2 = 1
delta = 0.75
SM = 80
m = 0.1:0.01:100;
if (S1-S2*m.^(delta))>=SM
S_avg = SM
elseif (S1-S2*m.^(delta))<SM & (S1-S2*m.^(delta))>0
S_avg = (S1-S2*m.^(delta))
else S_avg = 0
end
I want all the values that exceed SM to be equal to SM (as it is the limit) or let the iteration just stop there and keep the number as it is if the value is below SM (below the limit).
for whatever input S1, S2, delta, and SM is..
for a different equation will be used for each case..
Is that possible?