필터 지우기
필터 지우기

recreating mesh grid plot of polar formula

조회 수: 7 (최근 30일)
fima v
fima v 2023년 5월 20일
댓글: fima v 2023년 5월 21일
Hello,i want to recreate the photo shown bellow in matlab.
I have tried to build it as follows but i get a rectangular surface plot instead of circular.
Also i get my radian axis till 2000instead of 6.28.
how can i change my code to produce the circular plot?
Thanks.
a=0.819*10^(-3)
b=2.73*10^(-3)
Vo=15
rho=linspace(a,b,100)
t=2*pi*linspace(1,360,360)
func=Vo*(b/a)*(1./rho)
[rr,tt]=meshgrid(rho,t)
func_grid=Vo*(b/a)*(1./rr)
surf(rr,tt,func_grid)
shading interp

채택된 답변

Dyuman Joshi
Dyuman Joshi 2023년 5월 20일
"Also i get my radian axis till 2000 instead of 6.28."
Because your data spans from 2*pi to 2*pi*360 (~2262) instead of 0 to 2*pi.
a=0.819*10^(-3);
b=2.73*10^(-3);
Vo=15;
rho=linspace(a,b,100);
%Updated t
t=linspace(0,2*pi,360);
[rr,tt]=meshgrid(rho,t);
func_grid=Vo*(b/a)*(1./rr);
%Modify the inputs to surf to obtain a polar plot
surf(rr.*sin(tt),rr.*cos(tt),func_grid)
shading interp
colorbar
%change view as per requirement
view(2)
  댓글 수: 3
Dyuman Joshi
Dyuman Joshi 2023년 5월 21일
It's not clear to me as to what the final output should be.
Could show you an example?
fima v
fima v 2023년 5월 21일
Hello Dyuman,i want to create a phot as shown bellow.the plot is in the gradient of the field direction
is it possible in Matlab?
Thanks.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by