plotting a volume data in x and y plane

 Réponse acceptée

darova
darova le 21 Sep 2019

0 votes

Use volumeslice() or contourslice()

11 commentaires

Anandu S
Anandu S le 21 Sep 2019
the function is in spherical co-ordinates, so how to use slice?
darova
darova le 21 Sep 2019
21Capture.PNG
Look HERE
[x,y,z] = sph2cart(theta1,phi1,r1);
zslice=0;
slice(x,y,z,sinr,[],[],zslice);
To use slice we require the cartesian coordinates and that's where everythng goes wrong.
darova
darova le 21 Sep 2019
Why it goes wrong? You have converted your variables to cartesian
Looks ok for me. Show the whole script
clc;
clear all;
close all;
Am=30;
isd=750;
h=50;
n=3;
R=isd./(2*cosd(30));
ps=((3*sqrt(3)*(R^2))/2)^(-1);
PdB=44;
P=10.^((PdB-30)./10);
K=1;
G0=10^(26/10);
theta3dB=40.*(pi/180);
phi3dB=10.*(pi/180);
phi_tilt=-20.*(pi/180);
theta1=-180:180;
theta1=theta1.*(pi/180);
phi1=-90:90;
phi1=phi1.*(pi/180);
r1=0:350;
[theta phi r]=meshgrid(theta1,phi1,r1);
[u v w]=size(theta);
Nth=randn(u,v,w);
AhdB=-min(12.*(theta./theta3dB).^2,Am);
AvdB=-min(12.*((phi-phi_tilt)./phi3dB).^2,Am);
AdB=-min(-(AhdB+AvdB),Am);
GvdB=-min(12.*((phi_tilt)./phi3dB).^2,Am);
BdB=-min(min(12.*(theta./theta3dB).^2,Am),Am+GvdB);
B=10.^(BdB./10);
Gv=10.^(GvdB./10);
B_1=trapz(theta1,B,2);
B_2=B_1(1,1,1);
Ah1dB=-min(12.*(theta+(2*pi/3)./theta3dB).^2,Am);
Ah2dB=-min(12.*(theta-(2*pi/3)./theta3dB).^2,Am);
A1dB=-min(-(Ah1dB+AvdB),Am);
A2dB=-min(-(Ah2dB+AvdB),Am);
A=10.^(AdB./10);
A1=10.^(A1dB./10);
A2=10.^(A2dB./10);
s1=(3.*Gv.*ps.*((isd-r).^(2-n)).*B_2)./((n-2).*((r.^2+h.^2).^(-n./2)).*A);
s2=(A1+A2)./A;
s3=Nth./(G0.*P.*K.*((r.^2+h.^2).^(-n./2)).*A);
inv_sinr=s1+s2+s3;
sinr=1./(inv_sinr);
[x,y,z] = sph2cart(theta,phi,r);
zslice=0;
slice(x,y,z,sinr,[],[],zslice);
Error using interp3 (line 150)
Input grid is not a valid MESHGRID.
Error in slice (line 103)
vi = interp3(x,y,z,v,xi,yi,zi,method);
Error in analytic (line 70)
slice(x,y,z,sinr,[],[],zslice);
I get this error when I run it.
darova
darova le 22 Sep 2019
Ok i understood. So maybe another way:
  1. create plane in spherical system coordinates
  2. make slice in spherical
  3. convert data to cartesian
See attached script
Anandu S
Anandu S le 23 Sep 2019
Can you please get me a final script for my particular case?
darova
darova le 23 Sep 2019
Just replaced top part with yours (i also reduced number of mesh point, too much of them)
Anandu S
Anandu S le 23 Sep 2019
The output is not correct, might be because of sumthing did.Thanks for the help mate, the plotting part of the script is correct I guess.
darova
darova le 23 Sep 2019
Do you have source formulas for your code? Where are those come from?
Anandu S
Anandu S le 24 Sep 2019

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by