Author |
Topic |
|
KCl34
USA
2 Posts |
Posted - 10/25/2017 : 4:14:00 PM
|
Thanks for the support to this question. Old rusted user of Origin. Started using it again few months ago. I missed it so much.
I have a question: I have data for a chart in 2D; I would like to use the data to generate a 3D chart by a rotation extrusion (360)using one point of the X-axis as the center for the extrusion.
Ideas?
Emanuele cauda |
|
Hideo Fujii
USA
1582 Posts |
Posted - 10/26/2017 : 1:58:48 PM
|
Hi Emanuele cauda,
When y=f(x), you can take x as the radius for (X, Y), and y as Z. So, the following script calculate (X,Y,Z):///////////////////////////////////////////////////////
range rr=col(1); //original X
nr=rr.getSize(); //number of rows
kk=1; //output counter
for(ii=1; ii<=nr; ii++) { //take X
for(angle=0; angle<=360; angle++) {
col(3)[kk]=col(1)[ii]*cos(radians(angle)); //X in 3D
col(4)[kk]=col(1)[ii]*sin(radians(angle)); //Y in 3D
col(6)[kk]=col(1)[ii]; //Radius
col(5)[kk]=col(2)(col(1)[ii]); //Z in 3D
kk=kk+1;
}
}
/////////////////////////////////////////////////////// You see the result graphs as follows:
Hope this helps.
--Hideo Fujii OriginLab |
Edited by - Hideo Fujii on 10/26/2017 2:21:30 PM |
|
|
yuki_wu
896 Posts |
Posted - 10/27/2017 : 03:40:36 AM
|
Hi Emanuele cauda,
Besides the way Hideo introduced, we can also take advantage of the matrix and parametric surface.
For example, I have an XY plot with 50 pairs of data points:
1. New a matrix book, select Matrix: Set Dimension/Labels from menu
2. Select Matrix: Set Value… from menu Cell(i,j) = ra[j] Before Formula Script: range ra=[Book1]Sheet1!col(B)
3. Add the second matrix object in the matrix sheet, select the second matrix object and then select Matrix: Set Value… Cell(i,j) = y
4. Add the third matrix object in the matrix sheet, select the third matrix object and then select Matrix: Set Value… Cell(i,j) = rx[j] Before Formula Script: range rx=[Book1]Sheet1!col(A)
5. Add the fourth matrix object in the matrix sheet, select the fourth matrix object and then select Matrix: Set Value… Cell(i,j) = Mat(1)*cos(Mat(2))
6. Add the fifth matrix object in the matrix sheet, select the fifth matrix object and then select Matrix: Set Value… Cell(i,j) = Mat(1)*sin(Mat(2))
7. Select the fifth matrix, and plot a 3D surface
8. Double click the surface to open Plot Detail dialog, go to Surface tab, check Parametric Surface checkbox, then select Mat(3) in X Matrix and Mat(4) in Y Matrix.
9. Click the Rescale button
If you are interested, you can download the OPJ and play with it: https://www.dropbox.com/sh/phr7k6s29mn3nix/AACBuvXHkE1G-KZznzzjSvzZa/FilesToUsers?dl=0&preview=20171027-3D+Rotate+Surface.opj
Regards, Yuki OriginLab |
|
|
KCl34
USA
2 Posts |
Posted - 10/27/2017 : 4:08:58 PM
|
Yuki, Hideo, Thanks so much for the suggestions. I am going to try them up in the next few days and will let you know.
Emanuele cauda |
|
|
|
Topic |
|
|
|