# I want to find out vector subtraction of co-ordinates of 2 adjacent nodes of an element. How to proceed?

1 view (last 30 days)
S Priya on 30 Aug 2021
Commented: Wan Ji on 30 Aug 2021
Like , the element is 8-noded and I want to find out vector subtraction co-ordinates of 2 nodes(Node 1 and Node 3)
ie. |X11-X13|, |Y11-Y13| and |Z11-Z13|. How to proceed?
##### 0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

### Accepted Answer

Wan Ji on 30 Aug 2021
% if you have nodes and elements
% nodes n-by-3
% elements m-by-8
% Then
node1 = 1;
node2 = 3;
xrelative = abs(nodes(node1,1) - nodes(node2,1));
yrelative = abs(nodes(node1,2) - nodes(node2,2));
zrelative = abs(nodes(node1,3) - nodes(node2,3));
Or you can do
xyzrelative = abs(nodes(node1,:) - nodes(node2,:));
xrelative = xyzrelative(1);
yrelative = xyzrelative(2);
zrelative = xyzrelative(3);
##### 2 CommentsShow NoneHide None
S Priya on 30 Aug 2021
>> I am getting this output
'nodes' requires Navigation Toolbox.
Error in thirty (line 3)
xrelative = abs(nodes(node1,1) - nodes(node2,1));
How to proceed?
Wan Ji on 30 Aug 2021
So what kind of tool box you are using by showing such an error?
You are using
(1) Self-defined finite element analysis
(2) A toolbox released by mathworks, e.g. pde toolboox
(3) A toolbox released by indivisuals, e.g. FEATool Multiphysics
As my answer cannot cover the all code you have written. Please show more detail about your code

Sign in to comment.

### Categories

Find more on Structural Mechanics in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!