Polat plot with colors depending on values.

2 views (last 30 days)
Hello,
I'm solving PDE system numerically, as a result I've got the matrix sized (size(r), size(theta)) with values of function in different polar coords (radius, angle). I need to plot the surface like on this picture
The color of point must depend on value from result matrix.
Is there any built-in solution for this task? Here is the main part of my code, if it helps.
for t=1:nt-1
for i=2:nr-1
for j=2:nth-1
%derivatives
d2udr2= (u(i+1,j,t)-2*u(i,j,t)+u(i-1,j,t))/hr^2;
d2udth2= (u(i,j+1,t)-2*u(i,j,t)+u(i,j-1,t))/hr^2;
dudr=(u(i+1,j,t)-u(i-1,j,t))/(2*hr);
d2vdr2= (v(i+1,j,t)-2*v(i,j,t)+v(i-1,j,t))/hr^2;
dvdr=(v(i+1,j,t)-v(i-1,j,t))/(2*hr);
d2vdth2= (v(i,j+1,t)-2*v(i,j,t)+v(i,j-1,t))/hr^2;
%centre nodes
u(i,j,t+1)=u(i,j,t)+ht*(psi*(d2udr2+(1/r(i))*dudr+d2udth2)+u(i,j,t)*(1-k*v(i,j,t)));%u(i,j,t)*(1-ro*b*v(i,j,t))*(1-b*v(i,j,t)-u(i,j,t))); %u(i,j,t)*(1-u(i,j,t)-c*v(i,j,t)));
v(i,j,t+1)=v(i,j,t)+ht*(mu*(d2vdr2+(1/r(i))*dvdr+d2vdth2)+a*v(i,j,t)*(1-x*u(i,j,t)));%a*v(i,j,t)*(1-q*u(i,j,t))*(1-u(i,j,t)-b*v(i,j,t)));%a*v(i,j,t)*(1-c*u(i,j,t)-b*v(i,j,t)));
end
end
%boundaries for r
for j=1:nth
u(1,j,t+1)=u(3,j,t+1);
u(nr,j,t+1)=u(nr-2,j,t+1);
v(1,j,t+1)=v(3,j,t+1);
v(nr,j,t+1)=v(nr-2,j,t+1);
end
u(:,1,t+1)=u(:,nth-1,t+1);
v(:,1,t+1)=v(:,nth-1,t+1);
u(:,nth,t+1)=u(:,2,t+1);
v(:,nth,t+1)=v(:,2,t+1);
% %corners
u(1,1,t+1)=u(1,2,t+1);
u(1,nth,t+1)=u(1,nth-1,t+1);
u(nr,1,t+1)=u(nr-1,1,t+1);
u(nr,nth,t+1)=u(nr-1,nth,t+1);
v(1,1,t+1)=v(1,2,t+1);
v(1,nth,t+1)=v(1,nth-1,t+1);
v(nr,1,t+1)=v(nr-1,1,t+1);
v(nr,nth,t+1)=v(nr-1,nth,t+1);
end

Answers (1)

Danila Zharenkov
Danila Zharenkov on 11 Mar 2014
No ideas?

Community Treasure Hunt

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

Start Hunting!