Filter löschen
Filter löschen

Plot multiple lines in Matlab with animation

1 Ansicht (letzte 30 Tage)
Mark Sc
Mark Sc am 6 Feb. 2021
Kommentiert: Mark Sc am 7 Feb. 2021
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 Kommentare
Nora Khaled
Nora Khaled am 6 Feb. 2021
could you add more explanation? what are the coordinate in your attached picture?
Mark Sc
Mark Sc am 7 Feb. 2021
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

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by