[Master Index] [Index for .]

plot_truss

(./plot_truss.m)


Function Synopsis

plot_truss(nodes,members,displacements,scale)

Help text

 plot_truss(nodes,members,displacements,scale)
 Given the nodes, members, and displacements, this will plot the 
 given truss and the displaced shape. Currently the scale factor
 on the displaced shape is 1000. This can be changed to show 
 more or less displacement. Will work for frames, but no
 rotation is plottted

 nodes == [point;point;...]
 displacements == [ux,uy,uz;ux,uy,uz;...]
 members ==[node_i,node_j,otherstuff;node_i,node_j,other;...]
 Eric Soroos
 10-19-95


Cross-Reference Information

This function calls
This function is called by

Listing of function ./plot_truss.m

function plot_truss(nodes,members,displacements,scale)
% plot_truss(nodes,members,displacements,scale)
% Given the nodes, members, and displacements, this will plot the 
% given truss and the displaced shape. Currently the scale factor
% on the displaced shape is 1000. This can be changed to show 
% more or less displacement. Will work for frames, but no
% rotation is plottted
%
% nodes == [point;point;...]
% displacements == [ux,uy,uz;ux,uy,uz;...]
% members ==[node_i,node_j,otherstuff;node_i,node_j,other;...]
% Eric Soroos
% 10-19-95
%
 

[num_members,mc] = size(members);
if nargin ~= 4
   scale = 100;
end;

colmap  = jet;
[cr,cc] = size(colmap);
f = forces(nodes,members,displacements);
f = sc(f, cr,1);                %makes f an index to the colormap

%figure;
%view(150,30);

for i= 1:num_members
  node_i = members(i,1);
  node_j = members(i,2);
  Pi = nodes(node_i,:);
  Pj = nodes(node_j,:);
  assemble = [Pi;Pj];
    
  if nargin < 3
    
    line (assemble(:,1),...
      assemble(:,2),...
      assemble(:,3),'color',colmap(f(i),:));
  else
    displaced = assemble + scale* [displacements(node_i,1:3);
                          displacements(node_j,1:3)];
    line ([assemble(:,1),displaced(:,1)],...
      [assemble(:,2),displaced(:,2)],...
      [assemble(:,3),displaced(:,3)]);%,'color',colmap(f(i),:));
  end

  if (0==1)
    [n,s,t] = beam_nst(Pi,Pj,members(i,5));
    l= dot(Pi-Pj,n);
    base = (column(Pi)- l/2*n)';
    temp = [base;base+n';base;base+s';base;base+t'];
    line(temp(1:2,1),temp(1:2,2),temp(1:2,3),'color','r')
    line(temp(3:4,1),temp(3:4,2),temp(3:4,3),'color','b')
    line(temp(5:6,1),temp(5:6,2),temp(5:6,3),'color','g')
   end

end


axis('square');
setup_rotate; 



Produced by mat2html on Wed Jul 10 14:55:44 US/Pacific 1996
Cross-Directory links are: OFF