N
N
Nikneim22020-04-17 07:39:02
MATLAB
Nikneim2, 2020-04-17 07:39:02

How to make two-dimensional graphics from three-dimensional graphics on matlab?

I have a program that draws a 3D graph. And I need a two-dimensional at a fixed t.

spoiler
</function diffuzia
x0=0;
xt=10000;
t0=0;
tt=120000;
m=300;
n=10000;
dt=(tt-t0)/n;
h=(xt-x0)/m;
u(1:m/2,1)=0.3;
u((m/2+1):m+1,1)=0;
       


       for j=1:n
       for i=2:m
           if i==2
               u(i-1,j)=u(i,j);
           end
           if  i==m
           u(i+1,j)=u(i,j);
           
           end 
       u(i,j+1)=pdk(u(i,j))*dt*(u(i+1,j)-u(i,j))*(u(i,j)-u(i-1,j))/(h^2)+dk(u(i,j))*dt*(u(i+1,j)+u(i-1,j)-2*u(i,j))/(h^2)+u(i,j);
       end
       end

u(1,n+1)=u(2,n+1);
u(m+1,n+1)=u(m,n+1);

       
       
[xx,yy]= meshgrid(0:dt:tt,0:h:xt);
mesh(xx,yy,u);

end
></spoiler>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2020-04-17
@dimonchik2013

dt=0

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question