How can I make this script stop at a specific value for fl,fw,fh usw.?
t = 20 % temperature in C°
c = 331+(0.6.* t); % speed of sound (m/s)
w = 2.20;
l = 3.50;
h = 3.02;
% AXIAL MODES
m = 1:4;
fl = c/2 .* m/l;
fw = c/2 .* m/w;
fh = c/2 .* m/h;
% Tangential modes
ml = 1:4;
mw = 1:4;
mh = 1:4;
flw = c/2 * sqrt(bsxfun(@plus, (ml.'/l).^2, (mw/w).^2));
fwh = c/2 * sqrt(bsxfun(@plus, (mw.'/w).^2, (mh/h).^2));
flh = c/2 * sqrt(bsxfun(@plus, (ml.'/l).^2, (mh/h).^2));
% Oblique Modes
flwh = c/2 * sqrt(bsxfun(@plus,(flw(1:2,1:2) * 2/c).^2, permute(mh(1:2)/h,[3 1 2]).^2));
I already tried those:
if fl,fw,fh,flw,fwh,flh > 170
return
end
limit = 170;
if any(fl,fw,fh,flw,fwh,flh > limit)
return
end
thank you for your support. And I am sorry if it is a stupid question. Best regards and a nice evening.
Maurice

 Réponse acceptée

the cyclist
the cyclist le 16 Mar 2017
Modifié(e) : the cyclist le 16 Mar 2017
You just have the syntax wrong:
limit = 170;
if any([fl,fw,fh,flw,fwh,flh] > limit)
return
end
This is creating a vector out of your values, then checking each element of the vector against the limit (which will result in a logical vector), then seeing if any of those tests are true.

Plus de réponses (0)

Catégories

En savoir plus sur Audio I/O and Waveform Generation dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by