How to compute the gradient at each point of an arbitrary symbolic curve defined by "n" points?
5 次查看(过去 30 天)
显示 更早的评论
Hello,
I have a vector of "n" points describing a spline. I would like to compute the gradient at each of the "n" points.
Each point in this vector has 3 components, each of which is a symbolic expression in multiple variables.
The reason I am computing the gradients is to compare 2 curves (one of which I know each point in a 3-D space) with this. My criterion for comparison is that the cross product of gradients at each point must be zero. I am able to compute the gradients of the known curve using the matlab function "gradient". However, when i use the same function to compute for the symbolic points, I get the error
**************************************
First argument must be scalar.
***************************************
Any help on how I may proceed is apprecciated.
For ref:
known_points=[3Xn] % format double
dx_1=gradient(known_points(1,1:end));
dy_1=gradient(known_points(2,1:end));
dz_1=gradient(known_points(3,1:end));
% I am able to compute the above expressions.
unknown_points=[3Xn] %format sym
dx_2=gradient(unknown_points(1,1:end));
dy_2=gradient(unknown_points(2,1:end));
dz_2=gradient(unknown_points(3,1:end));
% I get the highlighted error when i compute the above expressions.
% alternately i have also tried dx_2=gradient(unknown_points(1,1:end), symvar(unknown_points)); to no avial.
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Assumptions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!