MATLAB: How to set extremum value of parameter extremum valueloopmaximumminimum I have a loop in which I change the value of a parameter. how can I set maximum and minimum values for that parameter? for example I want to set max(a)=5, min(a)=0 Best Answer To me, that the minimum is greater than the maximum does not make sense. That aside, try this: a = max(0, min(a,5))Testing it: a = -2:7a = max(0, min(a,5))produces: a = -2 -1 0 1 2 3 4 5 6 7a = 0 0 0 1 2 3 4 5 5 5Experiment to get the result you want. . Related SolutionsMATLAB: How to create matrix with parameter It seems like the kind of thing you would want a function for, rather than a matrix.RecoilEnergy=@(E,r) r.*(r<=E./(1+M./(2*E))) MATLAB: How to find the extremum search curve of a parametric surface If you have specific point (local max or min) you can substitute (x0,y0) in your function - first search curve (any x) - second search curve (any y) Related QuestionSimscape: setting common simulation parameterHow to switch simulink blocks using a parameter
Best Answer