/ MatLab Gurus...?

This topic has been archived, and won't accept reply postings.
GrendeI on 13 Sep 2012
HELP... I need to create a Matlab script that can plot the 'gaussian function'

i.e. plot f(x) on a graph where f(x)=exp(-ax^2)

uhhmm, apparently 'a' is a constant and f(x) uses 0< x <= 1

delta x is 0.01

also have to create a movie of it in operation but that's another mindf*ck...

If anyone cares to help a complete programming novice, it would be very much appreciated!
Hardonicus - on 13 Sep 2012
In reply to GrendeI:

x = [0:0.01:1]
a = 1;
fx = exp(-a.* x.^2)
plot(x,fx)
axis tight
EeeByGum - on 13 Sep 2012
In reply to Hardonicus: Ah - brings back wonderful memories of my final year project! :-)
GrendeI on 13 Sep 2012
In reply to Hardonicus: Thanks for that, tweaked a little to fit but it worked. Also managed to make the movie too :)

partial brainache relief!
Captain Fastrousers - on 13 Sep 2012
In reply to GrendeI:

> If anyone cares to help a complete programming novice, it would be very much appreciated!

A more general bit of advice would be that unless you're actually doing a lot of work with matrices (rather than arrays), then ditch the disastrous, slow, under-supported and expensive memory-hog that is Matlab, and install R instead. If you feel a great need to pay a license fee, at least go with IDL.

(Of course, if you are doing a lot of vector/matrix calculations, Matlab is actually pretty good).

needvert on 13 Sep 2012
In reply to Captain Fastrousers:

Seconded. Matlab sucks.

Though, at the level OP is doing matlab I suspect https://www.gnu.org/software/octave/ will do. It's quite good.

"The Octave language is quite similar to Matlab so that most programs are easily portable."


R is sweet too.

If I was doing a lot of matrix/vector styles, I'd probably look at NumPy.


(Coming from an extensive former matlab user)
needvert on 13 Sep 2012
In reply to needvert:

(+SciPy, awww, now I want to some numerical problem to solve!)
Glen - on 14 Sep 2012
In reply to GrendeI:

Matlab is great if it's the right tool for your job (i.e. not big, non matrix, number crunching).

This topic has been archived, and won't accept reply postings.