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

 채택된 답변

the cyclist
the cyclist 2017년 3월 16일
편집: the cyclist 2017년 3월 16일

0 개 추천

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.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by