Difference between revisions of "MATLAB talk:Plotting Surfaces"

From PrattWiki
Jump to navigation Jump to search
Line 1: Line 1:
{{Q}}
+
*I'm having trouble getting contour to plot more than the standard number of contour lines. When I use contour(x, y, z), it plots the contour lines fine, but when I specify the number of lines with contour(x, y, z, n), nothing plots. [[User:Jc257|Jc257]] 23:16, 22 September 2009 (EDT)
I'm having trouble getting contour to plot more than the standard number of contour lines. When I use contour(x, y, z), it plots the contour lines fine, but when I specify the number of lines with contour(x, y, z, n), nothing plots. [[User:Jc257|Jc257]] 23:16, 22 September 2009 (EDT)
+
*:I have had this same problem. I added a colorbar. When I don't give an "n" argument, the color bar ranges from 0 - 300, the range of the surface plot. When I add an "n" argument, the colorbar ranges from 0 - 1 in 0.1 intervals. If this is so, it makes sense that nothing is graphed, because the surface never gets as low as 1, but why would adding more contour lines change this? (I also tried plotting less contour lines - same thing happens.) [[User:Smc41|Smc41]] 09:39, 23 September 2009 (EDT)
 
+
** In both cases, the problem is you started with values that make the function go infinite - if you try to use <code>contour</code> with a matrix containing <code>Inf</code>, and then try to specify how many contour lines, MATLAB will become hopelessly confused.  Make sure d starts at 1 and theta starts at .1 and you should be able to get multiple contour lines.  [[User:DukeEgr93|DukeEgr93]] 13:26, 23 September 2009 (EDT)
{{Q}}
 
I have had this same problem. I added a colorbar. When I don't give an "n" argument, the color bar ranges from 0 - 300, the range of the surface plot. When I add an "n" argument, the colorbar ranges from 0 - 1 in 0.1 intervals. If this is so, it makes sense that nothing is graphed, because the surface never gets as low as 1, but why would adding more contour lines change this? (I also tried plotting less contour lines - same thing happens.) [[User:Smc41|Smc41]] 09:39, 23 September 2009 (EDT)
 

Revision as of 17:26, 23 September 2009

  • I'm having trouble getting contour to plot more than the standard number of contour lines. When I use contour(x, y, z), it plots the contour lines fine, but when I specify the number of lines with contour(x, y, z, n), nothing plots. Jc257 23:16, 22 September 2009 (EDT)
    I have had this same problem. I added a colorbar. When I don't give an "n" argument, the color bar ranges from 0 - 300, the range of the surface plot. When I add an "n" argument, the colorbar ranges from 0 - 1 in 0.1 intervals. If this is so, it makes sense that nothing is graphed, because the surface never gets as low as 1, but why would adding more contour lines change this? (I also tried plotting less contour lines - same thing happens.) Smc41 09:39, 23 September 2009 (EDT)
    • In both cases, the problem is you started with values that make the function go infinite - if you try to use contour with a matrix containing Inf, and then try to specify how many contour lines, MATLAB will become hopelessly confused. Make sure d starts at 1 and theta starts at .1 and you should be able to get multiple contour lines. DukeEgr93 13:26, 23 September 2009 (EDT)