how can i write code for animating the plots when i use column vector.
Ältere Kommentare anzeigen
i have two sets of data.
surge amplitude and tension magnitude. the time steps are different but the time for both starts at 0 to 10800 s.
i am trying to have a n animated plot of both data (surge and tension)
Antworten (2)
KSSV
am 27 Mai 2021
Let (t1,x1) and (t2,x2) be your data. Where x1 is surge and x2 is tension. Both t1, t2 are in same intervel.
First let's get them to same time t1 using interpolation.
x2 = interp1(t2,x2,t1) ;
Now you can plot them.
for t = 1:length(t1)
plot(t1(1:t),x1(1:t),'r',t2(1:t),x2(1:t),'b') ;
drawnow
pause
end
You can also use set, this will be the good option. Read about it.
You can save the animation into a gif using this link: https://in.mathworks.com/matlabcentral/answers/94495-how-can-i-create-animated-gif-images-in-matlab
7 Kommentare
Iman Ramzanpoor
am 27 Mai 2021
KSSV
am 27 Mai 2021
It seems your t2 data is not unique/ continuous. Attach your data.
Iman Ramzanpoor
am 27 Mai 2021
KSSV
am 27 Mai 2021
The range of each data is completely different.....
Iman Ramzanpoor
am 27 Mai 2021
KSSV
am 27 Mai 2021
for t = 1:length(t1)
plot(t1(1:t),x1(1:t),'r') ;
drawnow
pause
end
Also have a look on comet.
Iman Ramzanpoor
am 27 Mai 2021
Iman Ramzanpoor
am 14 Jun. 2021
0 Stimmen
Kategorien
Mehr zu Animation finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!