Plotting on a curved surface
5 views (last 30 days)
Show older comments
This question may be a bit vague but is there anyway to plot these droplets (i.e. the red dots) on a curved surface. All coordinates are in polar form but regarding the plotting surface I'm not sure if there's any way to change it. I have attached a picture of the plot and my code, if anyone is able to suggest any ideas it would be appreciated!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/336382/image.png)
a='.txt';
load('MyColormaps.mat','mycmap');
for i=500
str=int2str(i);
stp= strcat(str,a);
stp
c=load(stp,'w+');
s=size(c)
s1=s(1,1)
s2=s(1,2)
%b=zeros(s1,s1);
b=zeros(500,500);
%S2=sqrt(s1);
%b=zeros(S2,S2);
for ii=1:s1
x(ii,1)=c(ii,1);
y(ii,1)=c(ii,2);
r(ii,1)=c(ii,3);
[radial,theta] = cart2pol(x,y);
end
k=0;
for j=1:s1
if(r(j)>=0.005)
k=k+1;
rnew(k,1)=r(j);
xnew(k,1)=x(j,1);
ynew(k,1)=y(j,1);
[radialnew,thetanew] = cart2pol(xnew,ynew);
end
end
S1=k
for l=1:S1
xo=xnew(l,1);
yo=ynew(l,1);
R=rnew(l,1);
[radialo,thetao] = cart2pol(xo,yo);
for m1=1:1000
m=m1*10/1000;
for n1=1:1000
n=n1*10/1000;
if(((radialo-m)^2+(thetao-n)^2)^0.5)<=R
b(m1,n1)=1;
end
end
end
l
end
figure(i);
bas=figure(i);
imagesc(b);
axis([0 1000 0 160]);
axis square;
colormap(jet);
set(bas,'Colormap',mycmap);
print ('-dtiffn',sprintf('%d.tif',bas));
close all;
end
Answers (1)
Pratheek Punchathody
on 31 Aug 2020
Hi,
As all the data are in the polar coordinates (i.e. r and theta) the best possible way to visually represent the data is using the “polarplot()” which is in the 2D form.
0 Comments
See Also
Categories
Find more on Polar Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!