find coordinates in a 3D surface

16 vues (au cours des 30 derniers jours)
Don jaya
Don jaya le 9 Avr 2020
Commenté : Tommy le 9 Avr 2020
I created a 3D surface from some data (3 diffrect types of data) i have and i would like to know if there is way to get the Z value of the surface when i have x and y coordinates
  4 commentaires
Don jaya
Don jaya le 9 Avr 2020
b1= 220; %220 nm
b2= 230; %230 nm
b = (b2-b1).*rand(1000,1) + b1;
b_range = [min(b) max(b)] % Verify the values in ‘b’ are within the specified range.
F1=571;
F2= 600;
F = (F2-F1).*rand(1000,1) + F1;
F_range = [min(F) max(F)] % Verify the values in ‘F’ are within the specified range.
This is the code i used to generate random values of x and y. But I dont know how find the Z value of the surface with x and y cordinates.
darova
darova le 9 Avr 2020
Have you seen Tommy's comment above?

Connectez-vous pour commenter.

Réponse acceptée

Tommy
Tommy le 9 Avr 2020
Don,
Below is interp2 in action using your example. V contains the Z values of the surface at each x and y coordinate given by b_q and F_q. I plotted the results so you can see that they indeed fall on the surface.
S=[-0.255454267 -0.133439183 -0.128256946 -0.136393491 -0.255468915
-0.16954776 -0.124138607 -0.132083978 -0.15331931 -0.276954433
-0.149007109 -0.125119371 -0.144545525 -0.19557146 -0.177637749
-0.142308259 -0.130342974 -0.177935406 -0.293513073 -0.142214398
-0.143091331 -0.14808023 -0.255200581 -0.33992446 -0.144903974
-0.152250431 -0.186810311 -0.383070429 -0.227404801 -0.165688337
-0.173458918 -0.274784413 -0.337988554 -0.184649997 -0.202076672
-0.215458397 -0.426163051 -0.238819552 -0.192183079 -0.264126648
-0.296118044 -0.376116747 -0.223592627 -0.230149316 -0.401374229
-0.457434337 -0.269173229 -0.257644922 -0.318315139 -0.969651755
-0.604194199 -0.26876366 -0.356964444 -0.670992981 -1.096957392
-0.484240418 -0.372586852 -0.762060366 -1.860865499 -0.204448509
-0.486241078 -0.930879129 -1.466245538 -0.242279003 -0.13918949
-0.949288488 -0.686461129 -0.194905994 -0.131801436 -0.135274289
-1.227836372 -0.141137904 -0.129523095 -0.123579846 -0.144655103
-0.184073371 -0.112121011 -0.125105602 -0.1274451 -0.135966755
-0.126097195 -0.111480886 -0.127625548 -0.141547099 -0.112477805
-0.123054613 -0.115247217 -0.133692587 -0.171304665 -0.119313548
-0.123954137 -0.115627718 -0.155445668 -0.181042769 -0.103328849
-0.125608847 -0.131116045 -0.196642753 -0.127129097 -0.109099732
-0.13088475 -0.153715682 -0.165194111 -0.11087242 -0.123251795
-0.144666962 -0.210346991 -0.123862769 -0.115625486 -0.148200264
-0.180549319 -0.183485524 -0.120608115 -0.133266464 -0.189817587
-0.264454054 -0.136840163 -0.137537425 -0.164914623 -0.267378722
-0.333921576 -0.141928008 -0.171742136 -0.22204351 -0.4786693
-0.238605984 -0.175021793 -0.235943465 -0.362110584 -1.670325861
-0.219961365 -0.248464814 -0.407996359 -1.170102909 -0.314813224
-0.287398 -0.493354421 -1.58278747 -0.434704055 -0.139201807
-0.56232983 -1.903438905 -0.282327084 -0.129724103 -0.138308504
];
F =[ 570.4250 570.4250 570.4250 570.4250 570.4250
571.5000 571.5000 571.5000 571.5000 571.5000
572.5750 572.5750 572.5750 572.5750 572.5750
573.6500 573.6500 573.6500 573.6500 573.6500
574.7250 574.7250 574.7250 574.7250 574.7250
575.8000 575.8000 575.8000 575.8000 575.8000
576.8750 576.8750 576.8750 576.8750 576.8750
577.9500 577.9500 577.9500 577.9500 577.9500
579.0250 579.0250 579.0250 579.0250 579.0250
580.1000 580.1000 580.1000 580.1000 580.1000
581.1750 581.1750 581.1750 581.1750 581.1750
582.2500 582.2500 582.2500 582.2500 582.2500
583.3250 583.3250 583.3250 583.3250 583.3250
584.4000 584.4000 584.4000 584.4000 584.4000
585.4750 585.4750 585.4750 585.4750 585.4750
586.5500 586.5500 586.5500 586.5500 586.5500
587.6250 587.6250 587.6250 587.6250 587.6250
588.7000 588.7000 588.7000 588.7000 588.7000
589.7750 589.7750 589.7750 589.7750 589.7750
590.8500 590.8500 590.8500 590.8500 590.8500
591.9250 591.9250 591.9250 591.9250 591.9250
593.0000 593.0000 593.0000 593.0000 593.0000
594.0750 594.0750 594.0750 594.0750 594.0750
595.1500 595.1500 595.1500 595.1500 595.1500
596.2250 596.2250 596.2250 596.2250 596.2250
597.3000 597.3000 597.3000 597.3000 597.3000
598.3750 598.3750 598.3750 598.3750 598.3750
599.4500 599.4500 599.4500 599.4500 599.4500
600.5250 600.5250 600.5250 600.5250 600.5250];
b=[220 223 225 227 230
220 223 225 227 230
220 223 225 227 230
220 223 225 227 230
220 223 225 227 230
220 223 225 227 230
220 223 225 227 230
220 223 225 227 230
220 223 225 227 230
220 223 225 227 230
220 223 225 227 230
220 223 225 227 230
220 223 225 227 230
220 223 225 227 230
220 223 225 227 230
220 223 225 227 230
220 223 225 227 230
220 223 225 227 230
220 223 225 227 230
220 223 225 227 230
220 223 225 227 230
220 223 225 227 230
220 223 225 227 230
220 223 225 227 230
220 223 225 227 230
220 223 225 227 230
220 223 225 227 230
220 223 225 227 230
220 223 225 227 230
];
figure
surf(b, F, S)
grid on
xlabel('\bfb\rm')
ylabel('\bfFrequency\rm')
zlabel('\bfS-parameter\rm')
view(-120, 25)
b1= min(min(b)); %220 nm
b2= max(max(b)); %230 nm
b_q = (b2-b1).*rand(1000,1) + b1;
F1=min(min(F));
F2= max(max(F));
F_q = (F2-F1).*rand(1000,1) + F1;
V = interp2(b,F,S,b_q,F_q);
hold on;
plot3(b_q,F_q,V,'.')
  2 commentaires
Don jaya
Don jaya le 9 Avr 2020
Hi Tommy thank you so much for helping me to undestand. I really appreciate your help.
Tommy
Tommy le 9 Avr 2020
My pleasure!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Lighting, Transparency, and Shading dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by