Filter löschen
Filter löschen

flow control with functions of matrices

1 Ansicht (letzte 30 Tage)
Viesturs Veckalns
Viesturs Veckalns am 16 Okt. 2017
Beantwortet: Walter Roberson am 16 Okt. 2017
theta is a matrix [0:0.01:0.5]*pi
I want to evaluate a function t using a flow control of values of theta:
if theta>pi*(1/2 - 0.01)
t=Inf
else
t = tan(theta)
end
How to achieve such a flow control when theta is a matrix? t is assumed to be a matrix with the same dimensions as theta.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 16 Okt. 2017
t = inf(size(theta));
mask theta <= pi*(1/2 - 0.01);
t(mask) = tan(theta(mask));

Weitere Antworten (0)

Kategorien

Mehr zu Author Block Masks finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by