How to plot vector valued function with single input.
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Niklas Kurz
le 22 Déc 2020
Commenté : Walter Roberson
le 23 Déc 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 commentaires
Réponse acceptée
Walter Roberson
le 22 Déc 2020
syms phi real
f(phi) = [cos(phi); sin(phi)];
fplot(f)
3 commentaires
Walter Roberson
le 23 Déc 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)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Assumptions dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!