Borrar filtros
Borrar filtros

How to add slicer to the plot with time steps

1 visualización (últimos 30 días)
esat gulhan
esat gulhan el 28 de Ag. de 2020
Editada: esat gulhan el 28 de Ag. de 2020
Hi
I want to control my graph with time steps. I wish , if i chage slider, my 2D graph changes with time. Time step is 0 to 20 , time step 2,
My code is below, it is a diffusion equation..
clear; clc;syms alfa dx dt eq;
L=0.1;H=0.1;dx=0.01;dy=dx;dt=2;nx=uint32(L/dx+1);ny=uint32(H/dy+1);k=28;
alfa=12*10^-6;g=8*10^5;Ts=30;h=450;Fo=alfa*dt/(dx^2);
[X Y]=meshgrid(linspace(0,L,nx),linspace(0,H,ny));Tint=20;T=Tint*ones(ny,nx)
Tleft=20
Tright=20
Ttop=20
Tbottom=20
T(:,1)=Tleft;T(:,end)=Tright;T(1,:)=Ttop;T(end,:)=Tbottom;
time=20
n=time/dt
s=0
for tt=1:1:n
s=s+1;Tn=T;
for i=2:nx-1
for j=2:ny-1
T(j,i)=(Tn(j,i+1)+Tn(j,i-1)+Tn(j-1,i)+Tn(j+1,i))*Fo+g*dx^2/k*Fo+(1-4*Fo)*Tn(j,i);
end
end
[Xq Yq]= meshgrid(linspace(0,L,nx*5),linspace(0,H,ny*5)); colormap jet
subplot(6,1,[1 4]);title({'DIFFUSION EQUATION',sprintf('Time=%f seconds',s*dt)})
Vq=interp2(X,Y,T,Xq,Yq,'cubic',0);
contourf(Xq,Yq,Vq,20)
hold on
pause(0.5)
end
I want to add slicer and record graph 2 time steps when i used slicer i want to get the contours when 0sec, 2 sec,4sec etc...

Respuestas (0)

Categorías

Más información sobre Specifying Target for Graphics Output en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by