Plot function along one direction
Mostrar comentarios más antiguos
I want to plot a multivariate function (here as an example I take the max function, but it really could be any multivariate function f I want) along a direction. I have the following codes
F = @(x) max([3,4]+x.*[5,6]);
fplot(F)
But I get the following warning
Warning: Function behaves unexpectedly on array inputs. To improve performance, properly vectorize your function to return an
output with the same size and shape as the input arguments.
How can I resolve this? It doesn't make difference whether I put a dot before * or not, I still get this warning. Also I would need the function F defined since I want to do stuff with it like finding a maximum of F, i.e. the maximum of f in a specified line. Also I want my code to work for any multivariate function f no matter how many variables it has, so I can't write explicitly F=@(x) f(3+x*5,4+x*6), i.e. f need to take in one vector, not a fixed amount of scalars. Thanks a lot!
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Descriptive Statistics en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!