Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- sorting data

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

08-11-2016
12:09 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-11-2016
12:09 PM

sorting data

Hello,

Could anyone help me to sort the output of my attached program so I can plot I(k0) when x-axis is "d" and y-axis is "theta" ?

thank you very much in advance

Payman

Solved! Go to Solution.

1 ACCEPTED SOLUTION

Accepted Solutions

08-11-2016
03:11 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-11-2016
03:11 PM

I assume you want a 3D plot with d on the x-axis, theta on the y-axis, and I(k0) on the z-axis:

As others have noted, move stuff out of the inner loop that does not need to be there. You also don't need to create large vectors or matrices of intermediate results that you do not return from the program.

10 REPLIES 10

08-11-2016
12:51 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-11-2016
12:51 PM

Hi PR,

I tried to interpret your request, I hope I have guessed what you want.

Bye Bye

FM

08-11-2016
04:10 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-11-2016
04:10 PM

Thank you very much F.M.

Could you please briefly explain about the last graph? How did you generate it?

Thank you.

08-11-2016
02:15 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-11-2016
02:15 PM

Another approach is to use a 3D plot.

Stuart

PS: As FM has indicated, you can improve the efficiency of your programs by moving expressions out of loops where the expressions don't depend on the loop variable. If you don't intend to vary d, you could just replace it by j.

08-11-2016
03:11 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-11-2016
03:11 PM

I assume you want a 3D plot with d on the x-axis, theta on the y-axis, and I(k0) on the z-axis:

As others have noted, move stuff out of the inner loop that does not need to be there. You also don't need to create large vectors or matrices of intermediate results that you do not return from the program.

08-11-2016
03:29 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-11-2016
03:29 PM

Additional remark: In case you'd like to see theta in degrees rather than radians, you may change the last line in the program to read "Theta/deg" instead of "Theta".

I am a little bit confused as of the calculation of phi. Is it really an angle in radiant?

WE

08-11-2016
03:39 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-11-2016
03:39 PM

Mmm... I get this other plot.

Alvaro.

08-11-2016
04:42 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-11-2016
04:42 PM

When you call "CreateMesh" theta runs from 0 to 89, but those values are interpreted as radiants in your function, not as degrees as it should be. Try to let theta run from 0 to pi/2 and you should come closer to the plots we have seen in the posts before.

Furthermore because of the limit in the number ov intervals in "Createmesh" you won't get the resolution of Richards plot in d-direction.

I am still not sure if phi is really meant to be what is calculated here.

Werner

08-11-2016
05:02 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-11-2016
05:02 PM

Jejeje. Yes, you're right. i'm confuse rad with deg, as you prevent in your previous post.

Thanks, best regards.

Alvaro.

08-12-2016
08:56 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-12-2016
08:56 AM

I really appreciate all of you for your valuable suggestions. For the last step, I need to export the data to Sigmaplot. I was not able to do this step from the output of the suggested method, so I modified the program. The new data set generrates different contour plot in Mathcad , but when I transfer them to Sigmaplot, the same contour plot can be obtained as you obtained here. Am I doing a mistake here?

Thank you.

08-12-2016
02:17 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-12-2016
02:17 PM

In your last attempt you just create 3 vectors with the x-, y- and z-values of a bunch of points. Mathcad can't create a surface if it is just given a number of points - it does not know how to connect them - it would need a mesh.

But Mathcad can plot each point. Just change from contour plot to "scatter plot" and format the point size and color. I am not sure why, but the plot looks much better if I set a samll amount (1% is all it needs) of transparency.

Here is what I got:

Regards

Werner