Basic, but crucial, Matlab syntax question

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

Hi, sorry to post a very basic Matlab question my first time here but it's done out of abject desperation. I'm trying to translate a dsp algorithm, written as a matlab function, from a paper printout to meet a deadline. I've just started learing the Matlab syntax (as of 4 hours ago) and it's going well, but the interpretation of one line has me stuck and i can't continue on this till it's resolved.

someVariable = (1:increment:lastElement)

in this particular case: increment = 8 and lastElement = 100.

Now, unfortunatly, in all the tutorials, documentation and examples i've found 'lastElement' is a multiple of 'increment' so i don't know if the vector retuned in this case will end on 96, 100 or perhaps even 108?

as a side point i'm also not sure if the vector will be:

1 8 16 24 ...
or
1 9 17 25 ...

Any help will be greatly appreciated, and once again sorry if this seems very, very, daft.
Xan.

Post

Code: Select all

>> x = (1:8:100)

x =

     1     9    17    25    33    41    49    57    65    73    81    89    97
So, starting element is 1, which is incremented each time by 8 up to 100 or the last value before that.
Karel Bassez
Software Engineer
Vienna Symphonic Library GmbH

Post

Oh my god! You're a life saver! Though i was about to give and go to bed... hehe, ah well, back to it.

Thank you. :)
Xan.

Post

Eh....
How hard was it to check for yourself by doing exactly what AntiPro did? I mean, you had already told us how to test it.
Stefan H Singer
Musician, coder and co-founder of We made you look Web agency

Post

maybe he doesn't have matlab installed and just want to translate the code...

Post

Matlab is great. I just impressed the f**k out of a customer who had reall been struggling to grasp what I was talking about - I started Matlab and ran a script that displays (almost) real-time data in a very intuitive way, and I could see the token drop and insight happen immediately. It was as if life itself began behind his eyes thanks to a moving graph.

This has nothing to do with music or this thread, I just felt an urge to praise Matlab. :)
Rakkervoksen

Post

Maybe I should learn how to read?
Stefan H Singer
Musician, coder and co-founder of We made you look Web agency

Post

mdsp wrote:maybe he doesn't have matlab installed and just want to translate the code...
bingo :wink: - like i said, i looked at my first matlab code yesterday morning and all i'm working from is a paper copy, no .m file to actually run, or matlab to run it on.

thanks again, made a lot of progress.
Xan.

Post

I would have to say though that what makes matlab so rewarding is the instant gratification aspect (no compiling). That being said, the best way to learn is hands on. can you get a demo from mathworks perhaps?
my sig will go here

Post

There is (or at least used to be) a student version of Matlab which was pretty cheap. It limited the size of the matrices you could work with, but otherwise it was fine.

V.

Post

http://www.octave.org/

freeware, very matlab compatible.
Stefan H Singer
Musician, coder and co-founder of We made you look Web agency

Post

stefancrs wrote:http://www.octave.org/

freeware, very matlab compatible.
true, but not very useful on windows even if there's a cygwin version.

I should also mention scipy which is a scientific extension to python and can thus run on every plateform.
http://www.scipy.org/

and there's a windows distribution of python which has it buit-in:
http://www.enthought.com/
as well as many useful python extension like wxPython or VTK

Post

Help above and beyond :). You guys are lovely people. I looked into it and according to what i can find Matlab no longer offer a student version :(. But! Thanks to your pointers i've found and d/l'ed a couple of... what did that site call em? - Matlab clones, or whatever :). They've proved very usefull in helping me clear up confusion on a few other points, and saved me from asking more dumb questions of you lot, hehe.

It does seem like one hell of a powerfull language though. Those matrix opperations get really complex in my code and they're just one flippin' line in Matlab *sigh*. :)
Xan.

Post

Matlab does indeed have a student version. It cost 50 pounds here in the UK and it is well worth it, unless you want to sell your product of course.
http://www.mathworks.com/academia/student_version/
Ben
----
--------
----------------
www.mackie.com

Post

Xan, you might consider using some neat algebra math library, if a good one exists. I've never looked for one :)
Stefan H Singer
Musician, coder and co-founder of We made you look Web agency

Post Reply

Return to “DSP and Plugin Development”