# How can i get continuous plots with a video pause?

2 views (last 30 days)
Andi on 25 Jan 2022
Edited: Andi on 25 Jan 2022
Here is my initial script that works perfectly for my probem:
clear all
clc
xs=8;
v=3;
L=20;
ta=0.2;
t=1; %
n=1:1:40;
x=0:0.1:20;
omga = zeros(1,length(n)) ;
F = zeros(1,length(n)) ;
u = zeros(length(n),length(x)) ;
for j=1:length(n)
F(j)=exp(-((n(j)*pi*v*ta/L).^2)/4);
u(j,:)=sin(n(j)*pi*xs/L)*F(j)*sin(n(j)*pi*x/L)*cos(n(j)*pi*v/L*t(k)); % no loop needed
end
us = sum(u) ;
plot(x,us)
xlabel ('distance')
ylabel('Displacement')
Now I want to make 3 plots for different values of t. BUt it shows only one plot: how can i modify my script to get all the three plots in a short video.
clear all
clc
xs=8;
v=3;
L=20;
ta=0.2;
t=1:1:3; % this line is changed
n=1:1:40;
x=0:0.1:20;
omga = zeros(1,length(n)) ;
F = zeros(1,length(n)) ;
u = zeros(length(n),length(x)) ;
for j=1:length(n)
F(j)=exp(-((n(j)*pi*v*ta/L).^2)/4);
for k=1:length(t) % additional for loop
u(j,:)=sin(n(j)*pi*xs/L)*F(j)*sin(n(j)*pi*x/L)*cos(n(j)*pi*v/L*t(k)); % no loop needed
end
end
us = sum(u) ;
plot(x,us)
xlabel ('distance')
ylabel('Displacement')

### Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!