How to get the Z value of a point (X,Y) from surface plot?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

How to get the Z value of a point (X,Y) from surface plot?

Andre Yuhai
How can I get the Z value of a given point (X, Y) on a surface plot using octave-cli?

I am creating a simple surface plot using the code below. I am just playing around with the functions and plots to see what I can do and understand how to use them.


A = [1 2 3 4 5 6];
B = [7 8 9 10 11 12];
C = magic(6);

surf(A, B, C);

What I want is to get the value of a given point (X, Y) from the surface plot I've created with the given code above.

For example, on MATLAB you can get a value by hovering over a point on the plot, like in below screenshot.


But on Octave when you hover over the plot you just get (X, Y) values.

Actually when you use `Z1 = interp2(A, B, C, X1, Y1)`, you can get the result too, but, as far as I know, this is not getting the data from the plot.


Reply | Threaded
Open this post in threaded view
|

Re: How to get the Z value of a point (X,Y) from surface plot?

BGreen
Do you want it in the plot specifically? I don't know how to do that, but if you just want the data, then I would find out what indices the (X,Y) values correspond to, and then check the value in the matrix C with those indices. For example, if (X,Y)=(A(i),B(j)) then the value should be C(i,j).

- Brett Green


On Fri, Jul 19, 2019 at 4:45 PM Burak Kaymakci <[hidden email]> wrote:
How can I get the Z value of a given point (X, Y) on a surface plot using octave-cli?

I am creating a simple surface plot using the code below. I am just playing around with the functions and plots to see what I can do and understand how to use them.


A = [1 2 3 4 5 6];
B = [7 8 9 10 11 12];
C = magic(6);

surf(A, B, C);

What I want is to get the value of a given point (X, Y) from the surface plot I've created with the given code above.

For example, on MATLAB you can get a value by hovering over a point on the plot, like in below screenshot.


But on Octave when you hover over the plot you just get (X, Y) values.

Actually when you use `Z1 = interp2(A, B, C, X1, Y1)`, you can get the result too, but, as far as I know, this is not getting the data from the plot.



Reply | Threaded
Open this post in threaded view
|

Re: How to get the Z value of a point (X,Y) from surface plot?

Doug Stewart-4
In reply to this post by Andre Yuhai


On Fri, Jul 19, 2019 at 4:45 PM Burak Kaymakci <[hidden email]> wrote:
How can I get the Z value of a given point (X, Y) on a surface plot using octave-cli?

I am creating a simple surface plot using the code below. I am just playing around with the functions and plots to see what I can do and understand how to use them.


A = [1 2 3 4 5 6];
B = [7 8 9 10 11 12];
C = magic(6);

surf(A, B, C);

What I want is to get the value of a given point (X, Y) from the surface plot I've created with the given code above.

For example, on MATLAB you can get a value by hovering over a point on the plot, like in below screenshot.


But on Octave when you hover over the plot you just get (X, Y) values.

Actually when you use `Z1 = interp2(A, B, C, X1, Y1)`, you can get the result too, but, as far as I know, this is not getting the data from the plot.


try this

A = [1 2 3 4 5 6];
B = [7 8 9 10 11 12];
C = magic(6);

h=surf(A, B, C);
q=get(h)
q.zdata


--
DASCertificate for 206392



Reply | Threaded
Open this post in threaded view
|

Re: How to get the Z value of a point (X,Y) from surface plot?

BGreen
Yes, Burak - I didn't mean calling C(A(1), B(2)) like you said. What I said was that you need to find which indices correspond to that X value. For example, if Y=9, then you would want to find out i such that B(i)=9. In your example, i=3. You can do this with e.g. "yindex = find(B==9)".

(Please excuse me for forgetting the transposition with surf indexed as C(j,i) there.)

- Brett Green


On Fri, Jul 19, 2019 at 5:22 PM Doug Stewart <[hidden email]> wrote:


On Fri, Jul 19, 2019 at 4:45 PM Burak Kaymakci <[hidden email]> wrote:
How can I get the Z value of a given point (X, Y) on a surface plot using octave-cli?

I am creating a simple surface plot using the code below. I am just playing around with the functions and plots to see what I can do and understand how to use them.


A = [1 2 3 4 5 6];
B = [7 8 9 10 11 12];
C = magic(6);

surf(A, B, C);

What I want is to get the value of a given point (X, Y) from the surface plot I've created with the given code above.

For example, on MATLAB you can get a value by hovering over a point on the plot, like in below screenshot.


But on Octave when you hover over the plot you just get (X, Y) values.

Actually when you use `Z1 = interp2(A, B, C, X1, Y1)`, you can get the result too, but, as far as I know, this is not getting the data from the plot.


try this

A = [1 2 3 4 5 6];
B = [7 8 9 10 11 12];
C = magic(6);

h=surf(A, B, C);
q=get(h)
q.zdata


--
DASCertificate for 206392




Reply | Threaded
Open this post in threaded view
|

Re: How to get the Z value of a point (X,Y) from surface plot?

BGreen
Unfortunately, that I don't know. If you're fine with just linear interpolation, you could calculate it by hand that way, but that's the best I can suggest offhand.

By the way, please use reply all so these are sent to the mailing list too - maybe someone else will know an easy way to do this.

- Brett Green


On Fri, Jul 19, 2019 at 5:48 PM Burak Kaymakci <[hidden email]> wrote:
But what if I want an index that is not in my matrices A, and B but within the range?

Brett Green <[hidden email]>, 19 Tem 2019 Cum, 23:33 tarihinde şunu yazdı:
Yes, Burak - I didn't mean calling C(A(1), B(2)) like you said. What I said was that you need to find which indices correspond to that X value. For example, if Y=9, then you would want to find out i such that B(i)=9. In your example, i=3. You can do this with e.g. "yindex = find(B==9)".

(Please excuse me for forgetting the transposition with surf indexed as C(j,i) there.)

- Brett Green


On Fri, Jul 19, 2019 at 5:22 PM Doug Stewart <[hidden email]> wrote:


On Fri, Jul 19, 2019 at 4:45 PM Burak Kaymakci <[hidden email]> wrote:
How can I get the Z value of a given point (X, Y) on a surface plot using octave-cli?

I am creating a simple surface plot using the code below. I am just playing around with the functions and plots to see what I can do and understand how to use them.


A = [1 2 3 4 5 6];
B = [7 8 9 10 11 12];
C = magic(6);

surf(A, B, C);

What I want is to get the value of a given point (X, Y) from the surface plot I've created with the given code above.

For example, on MATLAB you can get a value by hovering over a point on the plot, like in below screenshot.


But on Octave when you hover over the plot you just get (X, Y) values.

Actually when you use `Z1 = interp2(A, B, C, X1, Y1)`, you can get the result too, but, as far as I know, this is not getting the data from the plot.


try this

A = [1 2 3 4 5 6];
B = [7 8 9 10 11 12];
C = magic(6);

h=surf(A, B, C);
q=get(h)
q.zdata


--
DASCertificate for 206392




Reply | Threaded
Open this post in threaded view
|

Re: How to get the Z value of a point (X,Y) from surface plot?

Andre Yuhai
Oh okay, sorry, I didn't know it is not being sent. I will do it from now on.
Thank you for the answers and the warning. :)

If I find anything, I can mail it again.

Brett Green <[hidden email]>, 20 Tem 2019 Cmt, 00:22 tarihinde şunu yazdı:
Unfortunately, that I don't know. If you're fine with just linear interpolation, you could calculate it by hand that way, but that's the best I can suggest offhand.

By the way, please use reply all so these are sent to the mailing list too - maybe someone else will know an easy way to do this.

- Brett Green


On Fri, Jul 19, 2019 at 5:48 PM Burak Kaymakci <[hidden email]> wrote:
But what if I want an index that is not in my matrices A, and B but within the range?

Brett Green <[hidden email]>, 19 Tem 2019 Cum, 23:33 tarihinde şunu yazdı:
Yes, Burak - I didn't mean calling C(A(1), B(2)) like you said. What I said was that you need to find which indices correspond to that X value. For example, if Y=9, then you would want to find out i such that B(i)=9. In your example, i=3. You can do this with e.g. "yindex = find(B==9)".

(Please excuse me for forgetting the transposition with surf indexed as C(j,i) there.)

- Brett Green


On Fri, Jul 19, 2019 at 5:22 PM Doug Stewart <[hidden email]> wrote:


On Fri, Jul 19, 2019 at 4:45 PM Burak Kaymakci <[hidden email]> wrote:
How can I get the Z value of a given point (X, Y) on a surface plot using octave-cli?

I am creating a simple surface plot using the code below. I am just playing around with the functions and plots to see what I can do and understand how to use them.


A = [1 2 3 4 5 6];
B = [7 8 9 10 11 12];
C = magic(6);

surf(A, B, C);

What I want is to get the value of a given point (X, Y) from the surface plot I've created with the given code above.

For example, on MATLAB you can get a value by hovering over a point on the plot, like in below screenshot.


But on Octave when you hover over the plot you just get (X, Y) values.

Actually when you use `Z1 = interp2(A, B, C, X1, Y1)`, you can get the result too, but, as far as I know, this is not getting the data from the plot.


try this

A = [1 2 3 4 5 6];
B = [7 8 9 10 11 12];
C = magic(6);

h=surf(A, B, C);
q=get(h)
q.zdata


--
DASCertificate for 206392




Reply | Threaded
Open this post in threaded view
|

Re: How to get the Z value of a point (X,Y) from surface plot?

BGreen
No problem! Good luck finding a solution.

- Brett Green


On Fri, Jul 19, 2019 at 6:25 PM Burak Kaymakci <[hidden email]> wrote:
Oh okay, sorry, I didn't know it is not being sent. I will do it from now on.
Thank you for the answers and the warning. :)

If I find anything, I can mail it again.

Brett Green <[hidden email]>, 20 Tem 2019 Cmt, 00:22 tarihinde şunu yazdı:
Unfortunately, that I don't know. If you're fine with just linear interpolation, you could calculate it by hand that way, but that's the best I can suggest offhand.

By the way, please use reply all so these are sent to the mailing list too - maybe someone else will know an easy way to do this.

- Brett Green


On Fri, Jul 19, 2019 at 5:48 PM Burak Kaymakci <[hidden email]> wrote:
But what if I want an index that is not in my matrices A, and B but within the range?

Brett Green <[hidden email]>, 19 Tem 2019 Cum, 23:33 tarihinde şunu yazdı:
Yes, Burak - I didn't mean calling C(A(1), B(2)) like you said. What I said was that you need to find which indices correspond to that X value. For example, if Y=9, then you would want to find out i such that B(i)=9. In your example, i=3. You can do this with e.g. "yindex = find(B==9)".

(Please excuse me for forgetting the transposition with surf indexed as C(j,i) there.)

- Brett Green


On Fri, Jul 19, 2019 at 5:22 PM Doug Stewart <[hidden email]> wrote:


On Fri, Jul 19, 2019 at 4:45 PM Burak Kaymakci <[hidden email]> wrote:
How can I get the Z value of a given point (X, Y) on a surface plot using octave-cli?

I am creating a simple surface plot using the code below. I am just playing around with the functions and plots to see what I can do and understand how to use them.


A = [1 2 3 4 5 6];
B = [7 8 9 10 11 12];
C = magic(6);

surf(A, B, C);

What I want is to get the value of a given point (X, Y) from the surface plot I've created with the given code above.

For example, on MATLAB you can get a value by hovering over a point on the plot, like in below screenshot.


But on Octave when you hover over the plot you just get (X, Y) values.

Actually when you use `Z1 = interp2(A, B, C, X1, Y1)`, you can get the result too, but, as far as I know, this is not getting the data from the plot.


try this

A = [1 2 3 4 5 6];
B = [7 8 9 10 11 12];
C = magic(6);

h=surf(A, B, C);
q=get(h)
q.zdata


--
DASCertificate for 206392




Reply | Threaded
Open this post in threaded view
|

Re: How to get the Z value of a point (X,Y) from surface plot?

Doug Stewart-4
In reply to this post by Andre Yuhai


On Fri, Jul 19, 2019 at 6:25 PM Burak Kaymakci <[hidden email]> wrote:
Oh okay, sorry, I didn't know it is not being sent. I will do it from now on.
Thank you for the answers and the warning. :)

If I find anything, I can mail it again.


look at interp2
 

Brett Green <[hidden email]>, 20 Tem 2019 Cmt, 00:22 tarihinde şunu yazdı:
Unfortunately, that I don't know. If you're fine with just linear interpolation, you could calculate it by hand that way, but that's the best I can suggest offhand.

By the way, please use reply all so these are sent to the mailing list too - maybe someone else will know an easy way to do this.

- Brett Green


On Fri, Jul 19, 2019 at 5:48 PM Burak Kaymakci <[hidden email]> wrote:
But what if I want an index that is not in my matrices A, and B but within the range?

Brett Green <[hidden email]>, 19 Tem 2019 Cum, 23:33 tarihinde şunu yazdı:
Yes, Burak - I didn't mean calling C(A(1), B(2)) like you said. What I said was that you need to find which indices correspond to that X value. For example, if Y=9, then you would want to find out i such that B(i)=9. In your example, i=3. You can do this with e.g. "yindex = find(B==9)".

(Please excuse me for forgetting the transposition with surf indexed as C(j,i) there.)

- Brett Green


On Fri, Jul 19, 2019 at 5:22 PM Doug Stewart <[hidden email]> wrote:


On Fri, Jul 19, 2019 at 4:45 PM Burak Kaymakci <[hidden email]> wrote:
How can I get the Z value of a given point (X, Y) on a surface plot using octave-cli?

I am creating a simple surface plot using the code below. I am just playing around with the functions and plots to see what I can do and understand how to use them.


A = [1 2 3 4 5 6];
B = [7 8 9 10 11 12];
C = magic(6);

surf(A, B, C);

What I want is to get the value of a given point (X, Y) from the surface plot I've created with the given code above.

For example, on MATLAB you can get a value by hovering over a point on the plot, like in below screenshot.


But on Octave when you hover over the plot you just get (X, Y) values.

Actually when you use `Z1 = interp2(A, B, C, X1, Y1)`, you can get the result too, but, as far as I know, this is not getting the data from the plot.


try this

A = [1 2 3 4 5 6];
B = [7 8 9 10 11 12];
C = magic(6);

h=surf(A, B, C);
q=get(h)
q.zdata


--
DASCertificate for 206392





--
DASCertificate for 206392