Plot multiple lines in Matlab with animation
2 次查看(过去 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
2021-2-6
could you add more explanation? what are the coordinate in your attached picture?
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!