MatLab code needed This function updates the coordinates of

MatLab code needed:

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.

Solution

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

MatLab code needed: This function updates the coordinates of each node in nodes by a corresponding amount in U. U is a column vector which describes deflections

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site