plotting a volume data in x and y plane

 Respuesta aceptada

darova
darova el 21 de Sept. de 2019

0 votos

Use volumeslice() or contourslice()

11 comentarios

Anandu S
Anandu S el 21 de Sept. de 2019
the function is in spherical co-ordinates, so how to use slice?
darova
darova el 21 de Sept. de 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 el 21 de Sept. de 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 el 22 de Sept. de 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 el 23 de Sept. de 2019
Can you please get me a final script for my particular case?
darova
darova el 23 de Sept. de 2019
Just replaced top part with yours (i also reduced number of mesh point, too much of them)
Anandu S
Anandu S el 23 de Sept. de 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 el 23 de Sept. de 2019
Do you have source formulas for your code? Where are those come from?
Anandu S
Anandu S el 24 de Sept. de 2019

Iniciar sesión para comentar.

Más respuestas (0)

Preguntada:

el 21 de Sept. de 2019

Comentada:

el 24 de Sept. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by