UKC

MatLab Gurus...?

New Topic
This topic has been archived, and won't accept reply postings.
 GarethSL 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!
Removed User 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 13 Sep 2012
In reply to Removed User: Ah - brings back wonderful memories of my final year project!
OP GarethSL 13 Sep 2012
In reply to Removed User: Thanks for that, tweaked a little to fit but it worked. Also managed to make the movie too

partial brainache relief!
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 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 13 Sep 2012
In reply to needvert:

(+SciPy, awww, now I want to some numerical problem to solve!)
 Glen 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).

New Topic
This topic has been archived, and won't accept reply postings.
Loading Notifications...