How plot time varying animated 3D surface of z which depends on x and y as well as time, t such as: z (x, y, t) = exp -(x-5t)^2 + (y- 5t)^2.

10 vues (au cours des 30 derniers jours)
z (x, y, t) = exp -(x-5t)^2 + (y- 5t)^2.
I need to plot z wrt independent variables x and y animating for time t= 0 to say, t= 10.

Réponse acceptée

KSSV
KSSV le 28 Jan 2022
t = linspace(0,10) ;
x = linspace(0,1) ; % choose your range
y = linspace(0,1) ; % choose your range
[X,Y] = meshgrid(x,y) ;
for i = 1:length(t)
Z = exp(-(X-5*t(i))).^2 + (Y-5*t(i)).^2. ;
surf(X,Y,Z)
shading interp
drawnow
end
  3 commentaires
KSSV
KSSV le 28 Jan 2022
What error you are getting? Show us your full code and error line. It is striaght forward to extend the given code to your case.
SUMIT KUMAR
SUMIT KUMAR le 28 Jan 2022
working with my equation with following code.
But i have modified my problem, i need plot of z which is cumsum of earlier function.
Can you please modify this code so that i can get plot of z instead of c.
c (x,y,t) = (486/t) * exp - (((x-0.415 t)^2 / (2.152*t)) + ((y-0.005 t)^2 / (0.0012*t)))
where x range from 0 to 17, y from 0 to 0.6 and t from 1 to 41.
z ( x, y,t) = c (x,y,1) + c (x, y,2) + .................. + c (x,y,t)
Need animated plot of Z over x and y varying with time
t = linspace(1,41) ;
x = linspace(0,17) ; % choose your range
y = linspace(0,0.6) ; % choose your range
[X,Y] = meshgrid(x,y) ;
for i = 1:length(t)
c = (486.82575/t(i)) * exp (-((((X -(0.415*t(i))).^2)/(2.1516*t(i)))+(((Y -(0.005*t(i))).^2)/(0.0012*t(i)))));
surf(X,Y,c)
axis([0 17 0 0.6 0 50])
shading interp
drawnow
pause (0.01)
end

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Animation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by