How to plot vector valued function with single input.
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Niklas Kurz
el 22 de Dic. de 2020
Comentada: Walter Roberson
el 23 de Dic. de 2020
I wonder if this is even possible and the question itself is redundant. Normaly a vector valued function is plotted with 2 inputs:
[x,y] = meshgrid(-1:0.1:1);
fx = x.^2;
fy = 3.*y;
quiver(x,y,fx,fy)
in order that each (x,y) input in the coordinate plane is adressed to an output (I suppose). Probably that's rather a question for Mathstack, but while I'm at it: is it possible to plot a function that goes like f(phi) = [cos(phi); sin(phi)] ?
0 comentarios
Respuesta aceptada
Walter Roberson
el 22 de Dic. de 2020
syms phi real
f(phi) = [cos(phi); sin(phi)];
fplot(f)
3 comentarios
Walter Roberson
el 23 de Dic. de 2020
You cannot do that.
If f in that syntax were a numeric array or a cell array, then the 0 would be an invalid index.
If f in that syntax is a symbolic function name that you are defining, then the arguments to f() on the left side of a symbolic function definition must each be scalar symbolic variable names or row vectors of symbolic variable names (unless there is only a single parameter, in which case it is permitted to be a column vector of symbolic variable names.) 0 is not a valid symbolic variable name, so f(phi,0) cannot be defined.
It is not possible to define a symbolic function in parts. For example it is not possible to define
f(0,0) = -1
f(0,phi) = sin(phi)
f(theta,0) = theta^2
Each symbolic function can only be defined in a single statement -- though the statement can use piecewise():
f(theta,phi) = piecewise(theta==0 & phi == 0, -1, theta == 0, sin(phi), phi == 0, theta^2, etc)
Más respuestas (0)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!