Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Function [new Modes] = updateNodeCoords (nodes, U) This function updates the coo

ID: 3110192 • Letter: F

Question

Function [new Modes] = updateNodeCoords (nodes, U) This function updates the coordinates of each node in nodes by a corresponding amount in U. U is a column vector which describes deflections in both the x-direction and y-direction of each node. It is 2*numNodes long. So, for example: U(1, 1) is the x deflection of node 1: newNodes (1, 1) = nodes (1, 1) + U(1, 1) U(2, 1) is the y deflection of node 1: newNodes (1, 2) = nodes (1, 2) + U(2, 1) U(3, 1) is the x deflection of node 2: newNodes (2, 1) = nodes (2, 1) + U(3, 1) U(4, 1) is the y deflection of node 2: newNodes (2, 2) = nodes (2, 2) + U(4, 1) U(5, 1) is the x deflection of node 3: newNodes (3, 1) = nodes (3, 1) + U(5, 1) etc., etc.

Explanation / Answer

function [newNodes]=updateNodeCoords(nodes,U)

n=length(nodes,1); % Determining no of nodes
newNodes=zeros(n,2); % Initiation of newnodes

for i=1:n
  
newNodes(i,1)=nodes(i,1)+U(2*i-1,1); % Defining New Coordinate
newNodes(i,2)=nodes(i,2)+U(2*i,1);
  
end
end