MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Need help w- simple program

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115182] Re: Need help w- simple program
  • From: Vincent <sheeplane at gmail.com>
  • Date: Tue, 4 Jan 2011 04:21:25 -0500 (EST)
  • References: <ifpj03$b2r$1@smc.vnet.net>

On 2 Jan., 11:11, "xscr... at gmail.com" <xscr... at gmail.com> wrote:
> i purchased a copy of home edition. As my first programming project,
> I'd like to simulate a lambertian (e.g. Intensity is a function of cos
> theta) led light source and plot the light intensity impinging on a
> surface 12" away. I'd like to plot the surface as 1024x1024 points
> with different colors for ranges of intensities.
>
> I know this is pretty simple with Mathematica, unfortunately I have no
> experience with Mathematica and don't know where to begin.
>
> Help!
>
> Thanks,
>
> Per

You could rewrite the intensity to be a function of the xy coordinates
of the plane, then use contourplot to generate a plot of it. If you
really need the number of points to be 1024x1024, then use table to
generate a matrix of the colorintensites and use arrayplot to generate
an image. Here is an example with the intensity function given just
substituted by f which is just the radius.

f[x_, y_] := Sqrt[x^2 + y^2]

ContourPlot[f[x,y], {x, -5, 5}, {y, -5, 5},PlotRange -> Full]

ArrayPlot[Table[f[x,y], {x, -5., 5., 10./(1024 - 1)}, {y, -5., 5., 10./
(1024 - 1)}], PlotRange -> Full]

I'll leave finding the correct form of f[x,y] up to you, but it's a
simple trigonometric assignment.


  • Prev by Date: Re: How to change the directory for the docs?
  • Next by Date: Re: How to change the directory for the docs?
  • Previous by thread: Need help w- simple program
  • Next by thread: AVI with sound