cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Generating many plots

JohnRudnicki
14-Alexandrite

Generating many plots

I would like to generate many plots using a range of different parameter values. I did 10 in the attached document manually using Quickplot. Is there a way to do this more efficiently especially if I would like to look at a larger number of plots? Thanks for any help.

6 REPLIES 6

Something like this is possible:

The variable parameter k has to be a range and must be the first function argument. Guess it won't work with more than one parameter.

x must be a range and to avoid lines connecting back the first and last point of the plots you have to set the type from "line" to "draw" and make the range variable for x a littlle bit larger (1.02( than the manually set plot limit (1).

Drawbacks are:

You can't use different colors or line styles - all plots share the same

k must be a range and so it must be a linear scale. It does not work with a vector of selected values or a vector created with logspace (which would be more appropriate in your case, I guess).

JohnRudnicki
14-Alexandrite
(To:Werner_E)

Thanks, as always. That was helpful and certainly more efficient than the way I was doing it. But my question was not clear. The document I posted has 10 different plots with 8 curves on each. Your answer addresses how to put multiple curves on each plot, but is there any way to generate the 10 plots except one by one. Ideally, I would like to generate more than 10. (Why do I want to do this you may ask -- because I am working with someone using Matlab. She generated 64 of these plots and I am trying to compare with her results. Probably the simpler solution is to monkey with her Matlab code, but I thought I would ask).

LucMeekes
23-Emerald III
(To:JohnRudnicki)

There is no way in Mathcad to 'automate' the generation of plots, like it may be in MatLab.

If you have a large number of plots to generate, and you want them to show similar content, best way is to create one, shape it until you are satisfied with how it looks, then copy it as many times as you need, then edit the input variables (expressions for x- and y traces) as needed for each of them.

Success!
Luc

Here is a small routine which overcomes some of the drawbacks.

The abscissa values X and the parameter values k can be ranges or vectors.

No need to use "draw" or to make the x range larger than necessary.

Still just one color and line style for all plots.

EDIT: I overlooked your answer where you clarified your needs. As Luc already said there is no automatic way to generate plots like in MatlLab.

You could do something like the attached, which makes it much easier to produce many plots as long as each plot has a similar structure and just varies by virtue of the varying values of k.

Alan

Thanks to all for the information and suggestions.

Top Tags