Plot multiple lines in Matlab with animation

3 次查看(过去 30 天)
Hi all,
I am trying to plot a line, and then another line
I already wrote the code, but the figure plotted not as I want (I attached what i want)
Any help please :
clc;
close all;
clear all;
nodal_coo=[0 0;1 0;2 0;3 0];
element_coon=[1 2;2 3;3 4];
disp=[0,0,.24,0,-0.2076,.1245,0,-2076,-.1245,0,0,-2491];
NE=3;
for i=1:NE
ncon(1)=element_coon(i,1)
ncon(2)=element_coon(i,2)
eldof=[3*element_coon(i,1)-2;3*element_coon(i,1)-1;3*element_coon(i,1);3*element_coon(i,1)-2;3*element_coon(i,1)-1;...
3*element_coon(i,1)]
del(:,i)=disp(eldof); % DISPLACEMENTS OBTAINED in arry form
end
f=figure;
hold on;
for i=1:NE
line(nodal_coo(element_coon(i,:),1),nodal_coo(element_coon(i,:),2),'linewidth',5,'color','b');
line(nodal_coo(element_coon(i,:),1)+del([1,4],i),nodal_coo(element_coon(i,:),2)+del([2,5],i),'linewidth',10,'color','r');
end
  2 个评论
Nora Khaled
Nora Khaled 2021-2-6
could you add more explanation? what are the coordinate in your attached picture?
Mark Sc
Mark Sc 2021-2-7
Hi,
Thanks for your reply,
The coordinates is in the code:
nodal_coo;
which means coordinates in x y and element_coon; means the nodal connectivity

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Animation 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by