Message Boards Message Boards

0
|
3142 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

[?] Use Iterator in a table containing a plot function?

Posted 5 years ago

In the following program, I want to generate four graphs by iterating the variable n and plotting the results as a 2 X 2 grid. The iterator does not seem to be working as expected even though it is in the correct format {n, nmin, nmax, dn}. The code completes the first iteration when n=5, but it does not finish for the other values of n. Where in my syntax is the problem?

Attachments:
POSTED BY: Jesse Sheinwald
2 Replies

Thanks

POSTED BY: Jesse Sheinwald
Posted 5 years ago

Try this

graphs = Table[Plot[{x, Evaluate[f[x, n]]}, {x, 0, \[Pi]}, 
    Ticks -> {{0, \[Pi]}, {1, 2, 3}}], {n, 5, 35, 10}];

Evaluate is needed because Plot has the HoldAll attribute.

Attributes[Plot]
(* {HoldAll, Protected, ReadProtected} *}
POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract