Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
Hello everyone,
I am a new mathcad user. I used to use python but we switched to mathcad prime 9 recently. I'm having a lot of trouble carrying out simple tasks with mathcad. It's certainly my beginner level on the software that explains this. I'm calling on your expertise to help me on a few points. Sorry if for you it's trivial but for me on mathcad it's really complicated at the moment. Here's my problem: I want to retrieve data from a calculation. I've written several fairly complex functions and I want to vary some of the parameters of these functions and retrieve the values. I then want to use Excel to plot the curves of these functions. I want to compare the curves for a given parameter, so as to visualize the impact of a parameter on the function.
Mathcad Prime 9.0
Solved! Go to Solution.
1) To make the finals S.. functions dependent on the variable parameters you have to make all functions involved to define these final function dependent on these parameters. Of course only if the intermediate functions also depend on that parameter. In case of your function Sd the parameter a1 seems only be introduced in the final definition of a1.
Using the parameters as additional function argument of the intermedeate function was shown in my previous sheet with functions f1 and f2 which finally make up function f3 and share a parameter a.
2) To plot the final function I suggest that you use the CreateMesh function as already shown in my sheet. You have to provide ranges for x and y to do so and optional grid size arguments.
The problem may be that CreateMesh fails if just one combination of x and y within the range provided returns a non-real result or runs into a calculation error (e.g. 'division by zero').
These problems could be trapped by a asking if the imaginary part of the function result is non-zero and by using the try...on error... statement.
See a possible way to do this for your function Sd with various values for parameter a1 in the attached sheet.
According the data export to Excel I already had shown in my previous sheet that you have to create vectors/matrices in Prime and then use WRITEEXCEL to export them.
What do you mean by this:
Furthermore I am missing the definitions of functions f1 and f2.
Your further examples on the pages thereafter seem to not use the variable a1 which you say is the variable you want to vary.
Can you provide a simple consistent worksheet showing just one example of what you would like to achieve?
Find attached a simple example of a function in two variables, based on one parameter a and constructed by combining two function in one variable, maybe its helpful.
Thank you for your reply. I can see that I still have a lot to learn before I can produce work of the quality of your reply. I'll try to be a little clearer in describing my problem. I've completed the description of my problem in a pdf file that I'm attaching to the post
1) To make the finals S.. functions dependent on the variable parameters you have to make all functions involved to define these final function dependent on these parameters. Of course only if the intermediate functions also depend on that parameter. In case of your function Sd the parameter a1 seems only be introduced in the final definition of a1.
Using the parameters as additional function argument of the intermedeate function was shown in my previous sheet with functions f1 and f2 which finally make up function f3 and share a parameter a.
2) To plot the final function I suggest that you use the CreateMesh function as already shown in my sheet. You have to provide ranges for x and y to do so and optional grid size arguments.
The problem may be that CreateMesh fails if just one combination of x and y within the range provided returns a non-real result or runs into a calculation error (e.g. 'division by zero').
These problems could be trapped by a asking if the imaginary part of the function result is non-zero and by using the try...on error... statement.
See a possible way to do this for your function Sd with various values for parameter a1 in the attached sheet.
According the data export to Excel I already had shown in my previous sheet that you have to create vectors/matrices in Prime and then use WRITEEXCEL to export them.
Merci pour votre réponse très détaillées et votre aide précieuse. Je vais poursuivre le travail en suivant vos conseils.
A quick calculation indicates you want a table of just over 4,231,854 rows. (261 x values by 16214 y values) I was under the impression that Excel has worksheet row & column limits of 1,048,576 rows by 16,384 columns, implying that you want a table with more rows than Excel can handle.
The CreateMesh output would fit into an Excel worksheet but not in the format you want. The first question is: Why do you need that many y data points? And the second is: Do you *need* to plot the results in Excel? (I know Excel has better plotting capabilities than Mathcad Prime currently has, but will the Mathcad 3D Plot suffice for your purposes?)
Stuart