how do I plot different 3D peaks in different locations in single polar plot

2 ビュー (過去 30 日間)
Rakesh V
Rakesh V 2019 年 7 月 15 日
コメント済み: Star Strider 2019 年 7 月 16 日
In the image shown below I have a peak at center in polar plot. I need like that six peaks surrounding this main peak. Surrounding these six peaks I need nine peaks. To put it simply, in K shell I need 6 peaks, in L shell I need 9 peaks with central peak intact. I need them all in polar plot only.
thanks for help
  2 件のコメント
dpb
dpb 2019 年 7 月 15 日
Please attach the jpg w/ the picture icon instead of as a paperclip download file...
Rakesh V
Rakesh V 2019 年 7 月 15 日
peakcenter.jpgthis is polar plot, i need similar six peaks surrounding it in the same plot, but not as total subplots. Meaning the width of the main peak will be reduced. I donot want the peaks in the cartesian coordinates. i need them in polar plots. Even the equation would suffice. Or else even the plotting code also will help me. Thanks once again. feel free to ask more questions to get to clarity.

サインインしてコメントする。

採用された回答

Star Strider
Star Strider 2019 年 7 月 15 日
Try this:
N = 500;
rv = linspace(0, 1, N); % Radius Vector
av = linspace(0, 2*pi, N); % Angle Vector
Ka = linspace(2*pi/12, 2*pi-2*pi/12, 6); % ‘K’ Angles
La = linspace(2*pi/18, 2*pi-2*pi/18, 9); % ‘L’ Angles
[R,A] = meshgrid(rv, av);
pkf = @(s) exp(-((((-15:15)).^2) + (((-15:15)).^2)')/s); % Creates Gaussian Peaks
Mf = @(M,r,c) M((-15:15)+r,(-15:15)+c); % Matrix Coordinates Grid For Each Peak
figure
[Xb,Yb,Zb] = pol2cart(A,R,zeros(size(R))); % Base Plane
surf(Xb,Yb,Zb)
hold on
surfc(Mf(Xb,16,16), Mf(Yb,16,16), pkf(50)*0.75) % Center Peak
for k = 1:numel(La) % ‘L’ Peaks
Rrow = 400;
ix = find(av <= La(k), 1, 'last');
[X(:,:,k),Y(:,:,k),Z(:,:,k)] = pol2cart(Mf(A,ix,Rrow),Mf(R,ix,Rrow),pkf(2)*0.25);
surf(X(:,:,k),Y(:,:,k),Z(:,:,k))
end
for k = 1:numel(Ka) % ‘K’ Peaks
Rrow = 200;
ix = find(av <= Ka(k), 1, 'last');
[X(:,:,k),Y(:,:,k),Z(:,:,k)] = pol2cart(Mf(A,ix,Rrow),Mf(R,ix,Rrow),pkf(5)*0.5);
surf(X(:,:,k),Y(:,:,k),Z(:,:,k))
end
hold off
shading interp
grid on
axis equal
view(-40,25)
producing:
how do I plot different 3D peaks in different locations in single polar plot - 2019 07 15.png
The grids are defined as (-15:15) for every peak and the coordinate arrays for them. If you change those dimensions, you will need to change them in both the ‘pkf’ and ‘Mf’ functions, as well as in the ‘Center Peak’ plot. The rest of the code should adapt automatically, although within limits.
Experiment to get the result you want.
  7 件のコメント
Star Strider
Star Strider 2019 年 7 月 16 日
Rakesh V’s Answer moved here:
Dear SS,
I am using the same code which you have written to generate polar plot. I am using 2014b which our university provided us. That is the reason why i am unable to use the code.
The error was at this point.
pkf = @(s,a) exp(-((((-15:15)).^2) + (((-15:15)).^2)')/s)*a; % Creates Gaussian Peaks
If I remove the transpose in the above equation it executes.
hence i had the problem it seems.
Anyhow i will work it from here
Thanks and regards for the help.
Star Strider
Star Strider 2019 年 7 月 16 日
My pleasure.
You did not descirbe the specific problems you are having. There may be ways to solve them if I know what they are.
My code works in 2019a, and does what you describe what you want it to do, following your original post.
If my Answer helped you solve your problem, please Accept it!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePolar Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by