Plot multiple lines in Matlab with animation

1 visualizzazione (ultimi 30 giorni)
Mark Sc
Mark Sc il 6 Feb 2021
Commentato: Mark Sc il 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 Commenti
Nora Khaled
Nora Khaled il 6 Feb 2021
could you add more explanation? what are the coordinate in your attached picture?
Mark Sc
Mark Sc il 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

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Animation in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by