How to make a surface in polar coordinates using polar3d?

Technical Source
2 min readJun 12, 2023

Hello! I have an integral for a function which I plot in polar coordinates at a fixed polar angle theta (th). How to write a 3D plot for R in polar coordinates (angles a and th changes)? I made it using pol2cart, but this is not the best way to present the result. If somebody can help me to plot using polar3D or something like this, it would be great. Thank you.

clear all

s = 3;

n = 1;

r = 1;

t = 0.1;

th = 0:10:360; % angle theta

a = 0:1:360; % angle alpha

b = sqrt(2*n*t);

L = sqrt((4*t+r²)/3);

fun = @(k,u,c,a) ((k.²).*exp(-1.5*k.²)).*((u.²).*(1-u.²).*exp(-(b.*u).²).*(cos(s.*k.*u.*cos(a)/L))).*(((cos(c)).²).*(cos(k.*sqrt(1-u.²).*(s.*sin(a).*cos(th).*cos(c)+s.*sin(a).*sin(th).*sin(c))/(L))));

f3 = arrayfun(@(a)integral3(@(k,u,c)fun(k,u,c,a),0,Inf,-1,1,0,2*pi),a);

B = ((6*sqrt(6)*(b³))/(erf(b)*(pi²)))*(1-(3/(2*b²))*(1-((2*b*exp(-b²))/(erf(b)*sqrt(pi)))))^(-1);

R = B*f3;

figure(3)

polar(a,R);

This is how it look in Cartesian coordinates (theta in radians), but it should look much better in polar3D.

NOTE:-

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help , Finance Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

This takes too long to run here (it took 336.315050 seconds — 00:05:36.315049 — just now on MATLAB Online) however it plots the surface on a ‘synthetic’ polar coordinate axis in 3D. It would be relatively straightforward to change the Z axis coordinates (or ellimiinate them entirely). The original problem was that the code for the polar axes was not complete. It now works, as it worked in my earlier code.

Try This:

s = 3;
n = 1;
p = 0.1; % this is time
tv = 0:10:360; %3; % this is angle theta for polar rotation
r = 1;
a = 0:10:360;
a = deg2rad(a);
tv = deg2rad(tv);
tic
for k = 1:numel(tv)
t = tv(k)
b = sqrt(2*n*p);
L = sqrt((4*p+r^2)/3);
fun = @(k,u,c,a) ((k.^2).*exp(-1.5*k.^2)).*((u.^2).*(1-u.^2).*exp(-(b.*u).^2).*(cos(s.*k.*u.*cos(a)/L))).*(((cos(c)).^2).*(cos(k.*sqrt(1-u.^2).*(s.*sin(a).*cos(t).*cos(c)+s.*sin(a).*sin(t).*sin(c))/(L))));
f3 = arrayfun(@(a)integral3(@(k,u,c)fun(k,u,c,a),0,Inf,-1,1,0,2*pi),a);
B = ((6*sqrt(6)*(b^3))/(erf(b)*(pi^2)))*(1-(3/(2*b^2))*(1-((2*b*exp(-b^2))/(erf(b)*sqrt(pi)))))^(-1);
R = B*f3;
ta = t*ones(size(tv));
[x,y,z] = pol2cart(a, R, ta);
X(k,:) = x;
Y(k,:) = y;

SEE COMPLETE ANSWER CLICK THE LINK

https://matlabarticlesworld.blogspot.com/2023/06/how-to-make-surface-in-polar.html

--

--

Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.